(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Children's Library | Biodiversity Heritage Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "More about CBM 4040 DOS"

MORE 
ABOUT 



CBM 4040 DOS 

fully documented 8c cross referenced by 

Gary van Beeck 




ThuisComputen 



Published by 
UltOBvwiJ ThuiiCainpiitar 

Zwedanburg 119, 2591 BO The Hague, Holland 



Copyright O 1985 by UltgeveriJ ThuisComputer 
All rit^its 



Copying, duplicating, selling or otherwise distribu- 
ting this product is hereby strictly forbidden, un- 
less prior written consent has been obtained from 
the publisher. 

The words Commodore and CBM are registered trade- 
marks of Commodore Business Machines. 

Every effort has been made to provide accurate in- 
formation in this book. However, neither the author 
nor the publisher will accept any responsibility for 
any loss or damage, tangible or intangible, result- 
ing from use or improper or unintended use of the 
information provided. 



Printed in Holland 



INTTRODUCTION 



This manual is the result of a desperate effort to 
find out more about the mysteries of the Commodore 4040 
Disk Drive and its Innards. Unlike Its brothers, the CBM 
8050/8250 and the 1541 systems, about which - without 
much help from Commodore - reasonable documentation was 
published soon after their Introduction, most of Its op- 
erating system remained a closely guarded secret. It was 
only through the efforts of enthusiasts like Jim Butter- 
field in Canada and Raeto West in England that titbits of 
interesting and useful Information have managed to come 
to light at all. 

The author has made an effort to unravel the 4040 
DOS in order to provide an annotated source listing. It 
Is obvious that the reader Is assumed to be reasonably 
familiar with machine language and with the contents of 
the 4040 User Manual. The book Is primarily aimed at the 
intermediate and advanced programmer but the author hopes 
it will also provide invaluable help to the novice user. 

No claim is made as to the accuracy of the informa- 
tion presented in this manual. It has been compiled with- 
out any help from Commodore and none of Its contents have 
been reviewed by them. The labels used in the source 
listings are generally those used by Commodore and non- 
Commodore authors. 

We welcome any supplementary Information and sug- 
gestions for this manual, which we shall gladly use in a 
subsequent edition. 



COfTENTS 
Bus Controller Section 



Bus Controller equates, labels and variables 3 

Command search table, disk Initialization 9 

Controller test 14 

Main system IRQ, IEEE routines 19 

Error processing 27 

Directory loading 35 

Parse and execute string in command buffer 38 

RSR test subroutines 46 

Lookup 48 

Transfer filename 54 

Get filename from directory 55 

NEW routine 59 

Scratcii files q-\ 
Format a diskette 

Rename file In directory 71 

t*/lemory, block access routines 75 

Find relative file 84 

Write routines 89 

Read routines 95 

Get routines 101 

Jobs 106 

Open 110 

Close, open channels 119 

Side sector pointers 133 

Write out relative records 139 

Add blocks to relative file 146 

Bus Controller Crossreference 153 



Disk Controller Section — refer to the yellow pages 



65 



DOS Operating System 4040 

line addr object source code 



page 



00006 


0000 


00007 


0000 


00008 


0000 


00009 


0000 


00010 


0000 


00011 


0000 


00012 


0000 


00013 


0000 


00014 


0000 


00015 


0000 


00016 


0000 


00017 


0000 


00018 


0000 


00019 


0000 


00020 


0000 


00021 


0000 


00022 


0000 


00023 


0000 


00024 


0000 


00025 


0000 


00026 


0000 


00027 


0000 


00028 


0000 


00029 


0000 


00030 


0000 


00031 


0000 


00032 


0000 



* * 

* * 

* Dual Floppy Controller * 

* * 

* CBM 2030 - 3030 - 3040 * 

* * 

* Disk Operating System * 

* ♦ 

* Compiled by * 

* Gary van Beeck * 

* The Hague, Holland * 

* * 

* ie 

* January 1985 * 

* ♦ 

* * 

* Copyright - © 1895 - All * 

* rights reserved * 

* « 

* UITGEVERIJ THUISCOMPUTER * 

* * 

* Zwedenburg 119 * 

* 2591 BD The Hague, Holland * 

* Phone (+31)(0)70 - 473.777 * 

* * 



00034 0000 Adapted from — among others — the Version 2.1 original source file 



equates 



page 



line addr 


object source code 


00036 0000 


==> Equates <== 


00037 0000 




00038 0000 


rom = $d000 


00039 0000 




00040 0000 


Irf = $80 


00041 0000 


getflg = $40 


00042 0000 


ovrflo = $20 


00043 0000 


outran = $50 


00044 0000 


nssl = 6 


00045 0000 


ssioff = 4+nssl+nssl 


00046 0000 


nssp . 120 


00047 0000 


mxchns = 8 


00048 0000 


id = $1000 


00049 0000 


maxsa = 18 


00050 0000 


vererr = 7 


00051 0000 


or = 13 


00052 0000 


maxtrk = 36 


00053 0000 


bfcnt = 12 


00054 0000 


bamjob - bfcnt 


00055 0000 


bamO - $4100 


00056 0000 


baral - $4200 


00057 0000 


cbptr = bamjob-l-baiDlc 


00058 0000 


errchn = mxchns-1 


00059 0000 


errsa = 16 


00060 0000 


cmdchn = mxchns-2 


00061 0000 


Ixint = $3f 


00062 0000 


cmdsa = 15 


00063 0000 


apmode = 2 


00064 0000 


mdmode = 3 


00065 0000 


rdmode = 


00066 0000 


wtmode = 1 


00067 0000 


reltyp = 4 


00068 0000 


dirtyp - 7 


00069 0000 


seqtyp - 1 


00070 0000 


prgtyp = 2 


00071 0000 


usrtyp = 3 


00072 0000 


typmsk s $e 


00073 0000 


irsa = 17 


00074 0000 


iwsa = 18 


00075 0000 


id2040 = $f 


00076 0000 


id2030 = $64 


00077 0000 


dosver = 2 


00078 0000 


fin2040 = $41 


00079 0000 


fin2030 " $42 


00080 0000 




00081 0000 




00082 0000 = 


=> Controller Job Types <=== 


00083 0000 




00084 0000 


read = $80 


00085 0000 


write = $90 


00086 0000 


wverfy = $a0 


00087 0000 


seek » $bO 



last record flag 

buffer dirty flag 

overflow flag 

out of range flag 

number of side sector links 

side sector offset 

number of side sector pointers in 

buffer 

maximum available channels 

controller ID byte 

highest secondary address 

carriage return 

maximum number of tracks plus one 

number of buffers 

BAM drive 
BAM drive 1 
vU command buffer pointer 

error channel 

secondary address for error channel 
command channel 
internal channel for LINDX 
command secondary address 
append mode 
modify mode 
read mode 
write mode 
relative file type 
direct access 
sequential file type 
program file type 
user file type 
type mask 

internal read secondary address 
internal write secondary address 
2040 controller ID 
2030 controller ID 
DOS version 
2040 format version 
2030 format version 



read a sector 
write a sector 
verify after write 
seek any sector 



equates 



page 



line addr object 



00088 


0000 


00089 


0000 


00090 


0000 


00091 


0000 


00092 


0000 


00093 


0000 


00094 


0000 


00095 


0000 


00096 


0000 


00097 


0000 


00098 


0000 


00099 


0000 


00100 


0000 


00101 


0000 


00102 


0000 


00103 


0000 


00104 


0000 


00105 


0000 


00106 


0000 


00107 


0000 


00108 


0000 


00109 


0000 


00110 


0000 


00111 


0000 


00112 


0000 


00113 


0000 


00114 


0000 


00115 


0000 


00116 


0000 


00117 


0000 


00118 


0000 


00119 


0000 


00120 


0000 


00121 


0000 


00122 


0000 


00123 


0000 


00124 


0000 


00125 


0000 


00126 


0000 


00127 


0000 


00128 


0000 


00129 


0000 


00130 


0000 


00131 


0000 


00132 


0200 


00133 


0201 


00134 


0202 


00135 


0203 


00136 


0204 


00137 


0204 


00138 


0204 



source code 

bump = $c0 
jumpc = $dO 
exec - $eO 



=> Job Error Codes <« 

goodj - 1 
nohdr - 2 
nosync - 3 
nodblk • 4 
badbch > 5 
wverer = 7 
wrprot = 8 
badhch » 9 
badblk - 10 
badid - 11 
badbyt - 16 
mxflls • 5 

cmdlnd " 30 
dlrlen « 24 
nbslz » 27 
ctbslz " 7 
cmdlen <■ 58 



=> I/O Definitions <« 



unlsn » $3f 

notrdy ■ $0 

talker > $80 

lisner = 1 

eolout - $80 

eoisnd > $08 

rdytlk - $88 

rdylst > $1 

rndrdy - rdytlk+rdylst 

rndeol - eoiout+rdylst 



»> I/O Registers <- 



* = $200 

leeedl * « *+1 

paddl ♦ - *+1 

leeedo * » *+l 

pbddl * - *+l 



* . $280 



move head to track 1 
jump to machine code In buffer 
execute code in buffer when speed & 
head ready 



Job completed successfully 

header block not found 

no sync character 

data block not found 

data block checksum error 

verify error after write 

write protect error 

header block checksum error 

data block too long 

ID mismatch error 

byte decoding error 

maximum number of filenames in 

string 

command buffer index ('''2) 

directory length used 

nambuf text size 

controller table size 

command string size 



IEEE unlisten comaand 
not ready 
IEEE talker flag 
IEEE listener flag 
talk with EOI 
not (EOI) to send 
talk no EOI 
ready to listen 
random CHNRDY 
random with EOI 



MOS 6532-1 

IEEE data in register 

IEEE data direction register 

IEEE data out register 

IEEE data out direction register 

MOS 6532-2 

IEEE control port register 1 



equates 



page ...,5 



line addr object 



00139 


0280 


00140 


0281 


00141 


0281 


00142 


0281 


00143 


0281 


00144 


0281 


00145 


0281 


00146 


0281 


00147 


0281 


00148 


0281 


00149 


0282 


00150 


0283 


00151 


0283 


00152 


0283 


00153 


0283 


00154 


0283 


00155 


0283 


00156 


0284 


00157 


0285 


00158 


0286 


00159 


0287 


00160 


0288 


00161 


0288 


00162 


0288 


00163 


0288 


00164 


0288 


00165 


1003 


00166 


1012 


00167 


1021 


00168 


1021 


00169 


1099 


00170 


1099 


00171 


109f 


00172 


lOaO 


00173 


lOal 


00174 


lOfO 


00175 


10f2 


00176 


10f3 


00177 


10f4 


00178 


10f4 


00179 


10f4 


00180 


10f4 


00181 


10f4 


00182 


10f4 


00183 


0000 


00184 


0002 


00185 


0004 


00186 


000a 


00187 


000c 



source code 


pad 2 


* = *+l 


atna 


= 1 


daco 


= 2 


rfdo 


= 4 


eoio 


= 8 


davo 


= 16 


eoii 


= 32 


davi 


= 64 


atni 


= 128 


padd2 


* = *+l 


pbd2 


* = *+1 


ledl 


= $8 


ledO 


= $10 


errled 


= 32 


ndaci 


= 64 


nrfdi 


= 128 


pbdd2 


* = *+l 


atnnd 


* = *+l 


atnpd 


* = *+l 


atnne 


* = *+1 


atnpe 


* = *+l 



=> Common Area Defines <== 



jobs 
trks 

hdrs 

numsec 
vernum 
actjob 

vnmi 

nmiflg 

autofg 

bufs 



♦=$1003 

*=*+15 

*=*+15 

♦=$1021 

*=*+120 

*=$1099 

*=*+ctbsiz-1 

*»*+! 

*=$10fO 

*=*+2 

= $1100 



=> Zero Page Variables <= 



*=$0 
usrjmp *=*+2 

bmpnt *=*+2 
temp *=*+6 
ip *=*+2 
Isnadr *=*+1 



attention acknowledge line 
(inverted) 



(inverted) 

direction register 1 

IEEE/LED register 2. Bits 0-2 = 

device number select 

active LED 1 

active LED 

hardware initialization error LED 



IEEE/LED direction register, control 
register 2 
ATN causes IRQ 



bus interrupt flag (lda=clr) 



Job queue 
job track table 
headers at $1021 
job header 
sectors/track table 

version number 
controller's active job 

indirect for NMI 
flag for NMI in progress 
enable (0)/disable (1) auto 
initialisation (read BAM) 
start of data buffers 



user jump table pointer (=$dd on 

release) 

bit map pointer 

temporary work space 

indirect pointer variable 

listen address 



equates 



page 



line addr object 



00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 



00222 
00223 

00224 
00225 

00226 

00227 

00228 

00229 
00230 
00231 



OOOd 
OOOe 
OOOf 
0010 

oon 

0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0019 
0019 
0019 
0019 
0019 
0019 
001a 
001b 
001c 
001 d 
001 e 
0022 
0027 
0029 
0029 
0029 
0029 
0029 



00219 0049 

00220 0049 

00221 0051 



0059 
0059 

0061 
0061 

0069 

0071 

0079 

0081 
0082 
0082 



source 


code 


tlkadr 


*=*+l 


Isnact 


*=♦+! 


tlkact 


»=*+1 


adrsed 


*=*+l 


prgtrk 
drvnum 


*=*+1 


track 


*=*+l 


sector 


*=*+1 


llndx 


*=*+l 


sa 


*=*+! 


orgsa 
data 


*,*+l 


to 

t1 
t2 
t3 
t4 
rO 


= temp 
= temp+l 
= temp+2 
= temp+3 
= temp+4 
*=*+! 


rl 


*=*+1 


r2 


*=*+! 


r3 


*=*+l 


r4 


*=*+l 


result 


*=*+4 


accum 


*=*+5 


dirbuf 


*=*+2 



=> Zero Page Arrays <=»== 

buftab *=*+cbptr+4 
cb = buftab+cbptr 
bufO *=*+mxchns 
bufl ♦=*+mxchn3 



nbkl 




reel 


*=*+nixchns 


nbkh 




rech 


*=*+iiixchns 


nr 


*=*+fflxchns 


rs 


*=*+mxchns 


ss 


♦=*+mxchns 


flptr 


♦=^+1 



talker address 
active listener flag 
active talker flag 
addressed flag 
last program accessed 
current drive number 
current track 
current sector 
logical index 
secondary address 
original SA 
temporary data byte 

temporary storage addresses 



temporary results 



storage for multiplication/division 
register for multiplication/division 
current buffer pointer lo 



buffer pointer table lo/hi, buffer 

- 15 

address lo, ind. pointer into 

command buffer 

table of channel numbers for 

buffers. $FF = inactive 

table of channel numbers for 

buffers. $FF = inactive 

table of lo bytes for record number 
for each buffer 

table of hi bytes for record number 

for each buffer 

table of next record number for 

buffers 

table of record sizes for each 

buffer 

table of side sectors for each 

buffer 

file stream 1 pointer 



equates 



line addr object 



page 



..7 



00232 


0082 


00233 


0082 


00234 


0082 


00235 


0083 


00236 


0084 


00237 


0085 


00238 


0086 


00239 


008b 


00240 


0090 


00241 


0098 


00242 


OOaO 


00243 


OOal 


00244 


00a2 


00245 


00b5 


00246 


OObd 


00247 


00c5 


00248 


00c6 


00249 


00c6 


00250 


00c6 


00251 


00c6 


00252 


00c6 


00253 


4300 


00254 


433a 


00255 


433b 


00256 


433c 


00257 


433d 


00258 


433e 


00259 


4340 


00260 


4344 


00261 


4345 


00262 


4346 


00263 


4347 


00264 


4348 


00265 


4349 


00266 


434a 


00267 


434b 


00268 


434c 


00269 


434d 


00270 


434e 


00271 


434e 


00272 


434e 


00273 


434e 


00274 


434e 


00275 


435c 


00276 


435d 


00277 


436b 


00278 


4373 


00279 


4374 


00280 


4375 


00281 


4376 



source 


code 


ariable 


s moved to / 


recptr 


*=*+l 


ssnum 


*=*+l 


ssind 


*=*+l 


relptr 


*=*+l 


filent 


*=*+nixfils 


fildat 


*=*+aixfils 


filtyp *=*+mxchns 


chnrdy 


*=*+nixchns 


eoiflg 


*=*+! 


Jobnum 


*=*+l 


lintab 


*=*+maxsa+l 


chndat 


*=*+mxchns 


Istchr 


*=*+iiixchns 


type 


*=*+! 



===> RAM Variables in $4300 <=== 



cmdbuf 

strsiz 

tempsa 

cmd 

Istsec 

bufuse 

dskid 

sec i no 

entfnd 

dirlst 

cmdwat 

linuse 

Ibused 

erblks 

rec 



*=$4300 

*=*+cmdlen 

*=*+l 

*=*+! 
*=*+] 
*=*+2 
*=*+4 
*=*+l 
*=*+! 

*=*+l 

*=*+] 
*=*+! 



trkss *=*+l 
secss *=*+! 

===> RAM Array Area <== 

Istjob *=*+bfcnt+2 
revcnt *=*+! 
errcnt *=*+bfcnt+2 
dirent *=*+mxchns 
erword *=*+] 
prgsec *=*+l 
wlindx *=*+l 
rlindx *=*+l 



position in record 

number of side sector 

index to side sector 

relative file pointer to track 

directory entry 

drive number, pattern 

channel file type, bit = drive 

channel status 

temp eoi, = set 

current job number 

SA: LINDX table 

channel data byte 

channel last character pointer 

active file type 



command buffer 
command string size 
temporary SA 
temporary job command 

buffer allocation 

current disk IDs 

sector increment for seq 

directory entry found (0) flag 

directory listen flag 

command waiting flag 

LINDX use word 

last buffer used 

blocks before abort 

record size, used by directory 

routines 

side sector track for directory 

routines 

side sector sector for directory 

routines 



last job 

errors recovery count 

error count on job 

directory entry 

error word for recovery 

last program sector 

write lindx 

read lindx 



equates 



page 



...8 



line addr object 



00282 


4377 


00283 


4379 


00284 


437a 


00285 


437b 


00286 


437c 


00287 


437d 


00288 


437e 


00289 


437f 


00290 


4380 


00291 


4380 


00292 


4380 


00293 


4380 


00294 


4380 


00295 


4386 


00296 


438b 


00297 


4390 


00298 


4390 


00299 


4390 


00300 


4390 


00301 


4390 


00302 


4391 


00303 


4392 


00304 


4393 


00305 


4394 


00306 


4395 


00307 


4396 


00308 


4397 


00309 


4398 


00310 


4399 


00311 


439a 


00312 


439b 


00313 


439c 


00314 


439d 


00315 


439e 


00316 


439f 


00317 


439f 


00318 


439f 


00319 


439f 


00320 


439f 


00321 


41 b4 


00322 


41 d8 


00323 


43dc 


00323 


43dc 


00324 


43dc 



source 


code 


nbtemp 


*=*+2 


cmdslz 


*=*+1 


cmdnuffl 


*=*+! 


char 


*=*+1 


limit 


*-*+! 


ficnt 


*=*+1 


f2cnt 


*=*+! 


f2ptr 


*.♦+! 



==> Parser Tables <= 



filtbl *=*+iiixfils+l 
filtrk *=*-Hnxfils 
filsec ♦=*+mxfils 



==> Channel Tables <= 



patflg 


*=*+! 


image 


*=*+1 


drvcnt 


*=*+1 


drvflg 


*=*+! 


Istdrv 


*=*+1 


found 


*=*+1 


dlrsec 


*=*+1 


delsec 


♦=*+! 


delind 


*=*+1 


Istbuf 


*=*+1 


index 


♦=*+! 


filcnt 


*=*+! 


typflg 


*-*+1 


iDode 


*=*+1 


jobrtn 


*=*+! 



==> RAM in Bitmap Buffers <= 

♦=$4100+180 
nambuf *=*+36 

♦=$4400-36 
errbuf =♦ 

.lib romtbl 



temporary number of blocks 
conmand string size 
command number 
character under parser 
pointer limit in comparing 
file stream 1 count 
file stream 2 count 
file stream 2 pointer 



filename pointer 
first link/track 
first link/sector 



pattern present flag 

file stream image 

number of drive searches 

drive search flag 

last drive without error 

found flag in directory searches 

directory sector 

sector of first available entry 

index of first available entry 

= if last block 

current index in buffer 

counter, file entries 

match by type flag 

active file mode (read/write) 

Job return flag 



directory buffer 
error message buffer 



roffltable 

line addr object source code 
00326 43dc *=roiii 

00328 dOGO ******************************************:^^^i:^:^*^^^ 

* 
* 
* 
* 



page 



..9 



00329 


dOOO 


* 


00330 


dOOO 


* 


00331 


dOOO 


* 


00332 


dOOO 


* 


00333 


dOOO 


* 


00334 


dOOO 


**: 


00336 


dOOO 




00337 


d2aO 




00338 


d2aO 


00 


00339 


d2a1 




00340 


d2a1 




00341 


d2a1 




00342 


d2a1 




00343 


d2a1 


49 


00344 


d2a4 


4d 


00345 


d2a7 


50 


00346 


d2aa 


53 


00347 


d2ac 




00348 


d2ac 




00349 


d2ac 




00350 


d2ac 




00351 


d2ac 




00352 


d2ac 


ca 


00353 


d2af 


af 


00354 


d2b2 


ea 


00355 


d2b3 


54 


00356 


d2b6 


17 


00357 


d2b7 




00358 


d2b7 


ec 


00359 


d2ba 


e7 


00360 


d2bd 


fc 


00361 


d2be 


e4 


00362 


d2c1 


e2 


00363 


d2c2 




00364 


d2c2 




00365 


d2c2 




00366 


d2c2 




00367 


d2c2 




00368 


d2c2 




00369 


d2c2 




00370 


d2c2 




00371 


d2c2 




00372 


d2c2 


51 


00373 


d2c3 




00374 


d2c3 


dd 


00375 


d2c4 


1c 


00376 


d2c5 


9e 


00377 


d2c6 





FORMAT code for controller resides here 



checksum d-rom 



code *-*+$2a0 
dchksm .byte 

=> Cofflaand Search Table <== 

56 44 cmdtbl .byte 'ivdmbupcrsn' init - drive verify - dir. 

duplicate 

42 55 

43 52 
4e 

memory - block - user - position 
disk copy - rename - scratch - new 



ncmds 



*-cmdtbl 



f3 50 cjumpl .byte <intdrv, <verdir, <duplct jump table lo 
b6 Of .byte <mem, <block, <user, <record 



7c c1 



.byte <dskcpy, <rename, <scrtch, <new 



e6 e3 cjumph .byte >intdrv, >verdir, >duplct jump table hi 
e8 e8 .byte >mem, >block, >user, >record 

e6 e2 .byte >dskcpy, >rename, >scrtch, >new 

* - cjumph-l-ncmds 
val = 1 validate (verify) cmd# 

■==> Structure images for commands <»= 

pcmd " 8 

.byte %01010001 disk copy 

struct » '^-pcmd commands not parsed 

.byte %1 101 11 01 rename 

.byte %00011100 scratch 

.byte 210011110 new 

Idcmd " *— struct load command image 



romtable 












page ...1 


line 


addr 


object 


source 


code 






00378 


d2c6 


Ic 






• byte 


%ooonioo 


load 


00379 


d2c7 














00380 


d2c7 










pgdrpgdr 




00381 


d2c7 










FS1 FS2 




00382 


d2c7 














00383 
00384 


d2c7 
d2c7 














bit representations: 


p not pattern 


00385 


d2c7 










g not greater than one file 


00386 


d2c7 










d no default drive(s) 


00387 


d2c7 










r requested filename 


00388 
00389 


d2c7 
d2c7 


























00390 


d2c7 


11 


18 1e 


trktbl 


.byte 


17,24,30,37 track/group table 


00391 


d2ca 


25 












00392 


d2cb 


52 


57 41 


modlst 


.byte 


'rwam' 


mode table: read, vrrlte, append, 
modify 


00393 


d2ce 


4d 












00394 


d2cf 






nmodes 


- *-iiiodlst 




00395 


d2cf 


44 


53 50 


tplst 


.byte 


'dspul' 


file type table 


00396 


d2d2 


55 4c 










00397 


d2d4 


44 


53 50 


typist 


.byte 


'dspur' 


DEL, SEQ, PRG, USR, REL 


00398 


d2d7 


55 


52 










00399 


d2d9 






ntypes 


-♦-typist 




00400 


d2d9 


45 45 52 


tpUst 


.byte 


'eerse' 




00401 


d2dc 


53 45 










00402 


d2de 


4c 


51 47 


tp21st 


.byte 


•Iqgrl' 




00403 


d2el 


52 


4c 










00404 


d2e3 














00405 


d2e3 


00 




erOO 


.byte 





error flag variables for BIT 


00406 


d2e4 


3f 




erO 


.byte 


$3f 




00407 


d2e5 


7f 




erl 


.byte 


$7f 




00408 


d2e6 


bf 




er2 


.byte 


$bf 




00409 


d2e7 


ff 




er3 


.byte 


$ff 




00410 


d2e8 














00411 


d2e8 


41 


42 


Ipbm 


.byte 


$41. $42 




00412 


d2ea 














00413 


d2ea 


11 


12 13 


sectrk 


.byte 


17, 18, 19 


, 21, 9, 2, fm2040 


00414 


d2ed 


15 


09 02 










00415 


d2fO 


41 












00416 


d2fl 


Oe 


Of 10 




.byte 


14, 15, 16 


, 18, 28, 30, fm2030 


00417 


d2f4 


12 


1c 1e 










00418 


d2f7 


42 












00419 


d2f8 














00420 


d2£8 














00421 


d2£8 








*=sectrk+ctbsiz+ctbsiz 


00422 


d2f8 






roml 


= * 






00422 


d2f8 














00423 


d2f8 








.lib dlsklnt 





10 



dlsklnt, Idle 



page ...11 



line addr object source code 



00425 
00426 
00427 
00428 
00429 
00430 
00431 
00432 
00433 
00434 
00435 
00436 
00437 
00438 

00439 
00440 
00441 
00442 
00443 
00444 
00445 
00446 
00447 
00448 
00449 
00450 
00451 
00452 
00453 
00454 
00455 

00456 
00457 
00458 
00459 
00460 
00461 
00462 
00463 
00464 
00465 
00466 
00467 



d2f8 

d2£8 

d2£8 

d2f8 

d2f9 

d2fb 

d2fe 

d301 

d301 

d301 

d301 

d301 

d303 

d304 

d306 

d307 

d308 

d30a 

d30a 

d30a 

d30a 

d30a 

d30a 

d30a 

d30a 

d30a 

d30d 

d30e 

d30f 

d311 

d3I3 

d314 
d316 
d319 
d319 
d31a 
d31b 
d31d 
d31f 
d320 
d322 
d323 
d325 



==> Error display routine <«=• 

blinks the (error number)+l in all three LEDs 

78 tabjmp sei 
a9 00 Ida #0 

8d 03 04 sta $403 
4c 04 fc Jmp $fc04 



=> Flash LED to signal error <= 

a2 00 pezro Idx #0 
2c .byte $2c 

a6 04 perr Idx temp 



to wait loop 



no error status entry 



9a txs 

ba pe20 tax 
a9 38 pe30 Ida #errled+ledO+ledl 



temporary work area holds error 

number 

use the stack as a storage register 



The LED mask $38 is made up as follows: 

ERRLED = 32 ($20) - hardware init error led 
+ LEDO = $10 - active LED 
+ LED1 =. $08 - active LED 1 



00468 d327 

00469 d329 

00470 d32b 

00471 d32b 



8d 82 02 

98 

18 

69 01 

dO fc 

88 

dO £8 
8c 82 02 

98 
18 

69 01 
dO fc 
88 

dO f8 
ca 

10 e3 
eO f c 

dO fO 
fO dc 



pdIO 
pd20 



pe40 

pdll 
pd21 



sta pbd2 
tya 
clc 
adc #1 
bne pd20 
dey 

bne pdIO 
sty pbd2 

tya 

clc 

adc #1 

bne pd21 

dey 

bne pdll 

dex 

bpl pe30 

cpx #$fc 

bne pe40 
beq pe20 



turn on all three LEDs 
clear the inner counter 

count the inner counter until zero 

when the hi byte of the timer 
reaches zero, 

turn off all LEDs 

wait 

clear the 

inner counter 

wait for it to reach zero 



have we blinked? 

no, blink again 

have we waited long enough between 

flashes? 

if not, wait some more, 

else repeat the entire sequence 



dlskint, Idle 








page ...12 


line 


addr 


object 


source 


1 code 




00472 


d32b 


-, — 


.> Disk 


initialization routine < 


:-=- 


00473 


d32b 












00474 


d32b 


78 




dsklnt 


sei 


prevent interrupts 


00475 


d32c 


d8 






eld 




00476 


d32d 


a2 


ff 




Idx #$ff 


enable output: 


00477 


d32f 


8e 


02 02 




stx leeedo 


IEEE data out 


00478 


d332 


8e 


03 02 




stx pbddl 


IEEE data out direction 


00479 


d335 


e8 






inx 


.X-0 


00480 


d336 


8e 


82 02 




stx pbd2 




00481 


d339 


a9 


Ic 




Ida #davo+eoio+rfdo 


00482 


d33b 


8d 


80 02 




sta pad2 


IF,F,R control port 


00483 


d33e 


a9 


If 




Ida #$lf 




00484 


d340 


8d 


81 02 




sta padd2 




00485 


d343 


a9 


38 




Ida lerrled+ledOtledl 


00486 


d345 


8d 


83 02 




sta pbdd2 




00487 


d348 












00488 


d348 


>S33 


.=.> Power-Up Diagnostic <=.= 




00489 


d348 












00490 


d348 


8a 




pulO 


txa 


fill zero page with ascending 
pattern 


00491 


d349 


95 


00 




sta $0,x 




00492 


d34b 


e8 






inx 




00493 


d34c 


dO 


fa 




bne pulO 




00494 


d34e 


8a 




pu20 


txa 


get .X into .Y 


00495 


d34£ 


a8 






tay 




00496 


d350 


c8 






iny 


start .Y counter one ahead of memory 


00497 


d351 


£6 00 


pu30 


inc $0,x 


bunp memory around to $00 


00498 


d353 


c8 






iny 


do the same with .Y 


00499 


d354 


dO 


fb 




bne pu30 


we're not there yetl 


00500 


d356 


b4 00 




Idy $0,x 


check if memory at $ff 


00501 


d358 


c8 






iny 




00502 


d359 


dO a6 




bne pezro 


no — something is wrong, so show 














error niunber 


00503 


d35b 


f6 


00 




inc $0,x 


$ff now, so bump memory to $00 


00504 


d35d 


dO 


a2 




bne pezro 


not zero — show error number 


00505 


d35f 


e8 






inx 


check next memory location 


00506 


d360 


dO 


ec 




bne pu20 




00507 


d362 












00508 


d362 


Test the 


three file side ROMS. On 


entry, .X is start of page. Exit if 
o.k. 

next error number (1 - 3 for ROMs D 
-F) 
save the page number as hi byte of 


00509 


d362 


e6 


04 


rmlO 


inc temp 


00510 


d364 


86 Ob 




stx ip+1 














pointer 


00511 


d366 


a9 


00 




Ida #0 


zeroize 


00512 


d368 


85 


Oa 




sta Ip 


the lo byte 


00513 


d36a 


a8 






tay 




00514 


d36b 


a2 


10 




Idx #$10 


16 pages in 4-K ROM 


00515 


d36d 


18 






clc 




00516 


d36e 


c6 


Ob 


rtlO 


dec ip+1 


let's do it backwards: 


00517 


d370 


71 


Oa 


rt20 


adc (ip),y 


add the ROM value to the contents of 

.A, 

increment the pointer and until it's 


00518 


d372 


c8 






iny 














zero 



diskint, idle 



page 



.13 



line addr object source code 



00519 d373 dO fb 

00520 d375 ca 

00521 d376 dO f6 

00522 d378 69 00 

00523 d37a aa 

00524 d37b c5 Ob 



00525 

00526 

00527 

00528 

00529 

00530 

00531 

00532 

00533 

00534 

00535 

00536 

00537 

00538 

00539 

00540 

00541 

00542 

00543 

00544 

00545 

00546 

00547 

00548 



d37d 
d37f 
d381 
d383 
d383 
d383 
d386 
d389 
d38a 
d38c 
d38e 
d391 
d393 
d394 
d396 
d399 
d39b 
d39c 
d39e 
d3aO 
d3a0 
d3a0 
d3aO 
d3a0 



dO 85 
eO dO 
dO df 



b9 fS d2 
99 00 11 
c8 

dO f7 
a9 dO 
8d 03 10 
e6 04 
c8 

dO fd 
ad 03 10 
fO 05 
ca 

30 f5 
dO dd 



===> Test 
a9 10 



bne rt20 

dex 

bne rtlO 
adc #0 
tax 
cmp ip+1 

perr2 bne perr 
cpx #jumpc 
bne rmlO 



rconl 

Ida 
sta 
iny 
bne 
Ida 
sta 
Inc 

cdelay iny 
bne 
Ida 
beq 
dex 
bmi 
bne 



tabjmp.y 
buf s , y 

rconl 
#Jumpc 
jobs 
temp 

cdelay 

Jobs 

cr20 

cdelay 
perr2 



branch back to RT20 to do another 

byte 

then do likewise with the other 

pages 

add in the last carry 

transfer the checksum 

and compare it with the hi byte of 

the count 

if they don't match, report error 

all three done? 



Error Display Routine 
transfer "jump to wait" loop 
to buffer at $1100 



send job type (jump) to 
job queue 



job queue definitions 



disk RAM except page $1000 <= 



00549 d3a2 85 Ob 

00550 d3a4 e6 04 



cr20 
cr30 



Ida #16 

sta lp+1 
inc temp 



00551 


d3a6 










00552 


d3a6 










00553 


d3a6 










00554 


d3a6 










00555 


d3a6 










00556 


d3a6 


a2 


04 


ramtst 


Idx #4 


00557 


d3a8 


98 




ralO 


tya 


00558 


d3a9 


18 






clc 


00559 


d3aa 


65 


Ob 




adc ip+1 


00560 


d3ac 


91 


Oa 




sta (lp),y 


00561 


d3ae 


c8 






iny 


00562 


d3af 


dO 


f7 




bne ralO 


00563 


d3b1 


e6 Ob 




inc ip+1 



save start of first block (page 

number) 

as hi pointer 

bump the error number ($03 is 

RAM problem) 

On entry, .X contains number of 
pages in block 

if pointer to first page 
Exit if o.k. 

save page count 

fill with address sensitive pattern 

add counter hi to accumulator and 
store 



if .Y is zero, first increment the 
hi pointer 



diskint. Idle 



page 



.14 



line 


addr 


object 


source 


1 code 




00564 


d3b3 


ca 




dex 




00565 


d3b4 


dO f2 




bne 


ralO 


00566 


d3b6 


a2 04 




Idx #4 


00567 


d3b8 


c6 Ob 


ra30 


dec 


ip+1 


00568 


d3ba 


88 


ra40 


dey 




00569 


d3bb 


98 




tya 




00570 


dSbc 


18 




clc 




00571 


d3bd 


65 Ob 




adc 


ip+1 


00572 


d3bf 


dl Oa 




cmp 


(ip).y 


00573 


d3cl 


dO ba 




bne 


perr2 


00574 


d3c3 


49 ff 




eor 


#$ff 


00575 


d3c5 


91 Oa 




sta 


(ip).y 


00576 


d3c7 


51 Oa 




eor 


(ip).y 


00577 


d3c9 


91 Oa 




sta 


(ip).y 


00578 


d3cb 


dO bO 




bne 


perr2 


00579 


d3cd 


98 




tya 




00580 


d3ce 


dO ea 




bne 


ra40 


00581 


d3d0 


ca 




dex 




00582 


d3dl 


dO e5 




bne 


ra30 


00583 


d3d3 


a5 Ob 




Ida 


ip+1 


00584 


d3d5 


18 




clc 




00585 


d3d6 


69 10 




adc #$10 


00586 


d3d8 


c9 50 




cmp 


#$50 


00587 


d3da 


dO c6 




bne 


cr30 


00588 


d3dc 










00589 


d3dc 










00590 


d3dc 


===> Controller 


test 


<== 


00591 


d3dc 










00592 


d3dc 


a2 ft 


diagok Idx #$ff 


00593 


d3de 


9a 




txs 




00594 


d3df 


ad 82 02 




Ida 


pbd2 


00595 


d3e2 


29 c7 




and #255-errlec 


00596 


d3e4 


8d 82 02 




sta 


pbd2 


00597 


d3e7 


ad 82 02 




Ida 


pbd2 


00598 


d3ea 


29 07 




and #%00000111 


00599 


d3ec 


09 48 




ora 


#%01001000 


00600 


d3ee 


85 Od 




sta 


tlkadr 


00601 


d3fO 


49 60 




eor 


#201100000 


00602 


d3f2 


85 Oc 




sta 


Isnadr 


00603 


d3f4 










00604 


d3f4 


a2 00 


inttab Idx #0 


00605 


d3f6 


aO 00 




Idy #0 


00606 


d3f8 


a9 00 


Inttl 


Ida #0 


00607 


d3fa 


95 29 




sta 


buftab.x 


00608 


d3fc 


e8 




inx 




00609 


d3fd 


b9 f f fO 




Ida 


bufind.y 


00610 


d400 


95 29 




sta 


buftab.x 


00611 


d402 


e8 




inx 




00612 


d403 


c8 




iny 




00613 


d404 


cO Oe 




cpy 


#bfcnt+2 


00614 


d406 


dO fO 




bne 


inttl 


00615 


d408 


a9 00 




Ida #<cmdbu£ 



then decrement the page count 
and repeat until zero 
restore the page count 
check the pattern backwards 

generate the pattern again 



if not OK, 

report error 

now test the reverse pattern 

result should be $00 — is it? 

no — report error 
if .y not 0, we have 
more to do on this page 
any pages left? 

get first page of block 

no — next block 
are we done? 
no 



reset 
the stack 
clear LEDs 
-ledO-ledl 
turn it off 

compute primary address 
mask device number 
set bit 3 and talk flag 
talker address 
clear talk, set listen 
listener address 

initialize buffer pointer table 



buffer pointer lo 

hi byte table of pointers to data 

buffer 

buffer pointer lo 



14 buffers 

if more buffers to do. 

set pointers to command buffer 

at$4300 



diskint, idle 














page ... 


line 


addr 


object 


source code 




00616 


d40a 


95 29 


sta buftab,x 


buffer pointer lo 


00617 


d40c 


e8 


inx 




00618 


d40d 


a9 43 


Ida #>ciiidbuf 




00619 


d40f 


95 29 


sta buftab.x 




00620 


d411 


e8 


inx 




00621 


d412 


a9 dc 


Ida #<errbuf 


set pointers to error buffer at 
$43dc 


00622 


d414 


95 29 


sta buftab.x 




00623 


d416 


e8 


inx 




00624 


d417 


a9 43 


Ida #>errbuf 




00625 


d419 


95 29 


sta buftab.x 




00626 


d41b 


a9 ff 


Ida #$ff 




00627 


d41d 


a2 12 


Idx #maxsa 




00628 


d41f 


95 a2 


dskinl sta lintab.x 


make all SAs inactive 


00629 


d421 


ca 


dex 




00630 


d422 


10 fb 


bpl dskinl 




00631 


d424 


a2 07 


Idx #mxchns-l 


set maximum channels minus 1 as 
unused 


00632 


d426 


95 49 


dskin2 sta bufO.x 


channel buffer table 1 


00633 


d428 


95 51 


sta bufl ,x 


channel buffer table 2 


00634 


d42a 


95 79 


sta ss,x 


side sectors table 


00635 


d42c 


ca 


dex 




00636 


d42d 


10 f7 


bpl dskin2 




00637 


d42f 


a9 Oe 


Ida #bfcnt+2 


set buffer pointers 


00638 


d431 


85 4f 


sta bufO+cmdchn 




00639 


d433 


a9 Of 


Ida #bfcnt+3 




00640 


d435 


85 50 


sta bufOferrchn 




00641 


d437 


a9 07 


Ida #errchn 




00642 


d439 


85 b2 


sta lintab+errsa 




00643 


d43b 


a9 86 


Ida #cindchn+$80 


channel 6 


00644 


d43d 


85 bl 


sta lintab-t-cmdsa 




00645 


d43£ 


a9 3f 


Ida #lxint 


LINDX to 5 free 


00646 


d441 


8d 48 43 


sta llnuse 


LINDX use word 


00647 


d444 


a9 01 


Ida #rdylst 




00648 


d446 


85 9e 


sta chnrdy+cmdchn 


00649 


d448 


a9 88 


Ida #rdytlk 




00650 


d44a 


85 9f 


sta chnrdy+errchn 


00651 


d44c 


a9 00 


Ida #0 


set up 


00652 


d44e 


8d 3e 43 


sta bufuse 


buffer allocation register 


00653 


d451 


a9 fO 


Ida #$fO 




00654 


d453 


8d 3f 43 


sta bufuse+1 




00655 


d456 


20 16 e8 


Jsr usrint 


uO points to ($00) 


00656 


d459 


a9 dc 


Ida #<diagok 




00657 


d45b 


8d fO 10 


sta vniDi 


Indirect for NMI to 


00658 


d45e 


a9 d3 


Ida #>diagok 


point to diagnostic 


00659 


d460 


8d fl 10 


sta vnmi+l 


routine 


00660 


d463 


a9 Oa 


Ida #10 


normal sector offset 


00661 


d465 


8d 44 43 


sta secinc 


increment between sectors 


00662 


d468 


8d 5c 43 


sta revcnt 


error recovery counter 


00663 


d46b 








00664 


d46b 








00665 


d46b 









diskint, idle 








page ...16 


line 


addr 


object 




source 


code 




00666 


d46b 


=> Set 1 


jp sectors per track depending on resident controller <=== 


00667 


dA6b 












00668 


d46b 


ad 00 


10 


setsec 


Ida id 


look at controller ID byte 


00669 


d46e 


a2 00 






Idx #0 


is it 


00670 


d470 


c9 Of 






cmp #id2040 


a 2040? 


00671 


d472 


fO Ob 






beq sets30 


jump to load table 


00672 


d474 


a2 07 




setslO Idx #$07 


is it a 


00673 


d476 


c9 64 






cmp #ld2030 


3040 or 40407 


00674 


d478 


fO 05 






beq sets30 


Jump to load table 


00675 


d47a 


e6 04 




sets20 


Inc temp 




00676 


d47c 


4c 04 


d3 




jmp perr 


not a good controller 


00677 


d47f 












00678 


d47f 


aO 00 




sets30 


Idy #0 


set up table 


00679 


d481 


bd ea 


d2 


sets40 


Ida sectrk.x 


sectors/track for formatting 


00680 


d484 


99 99 


10 




sta numsec.y 


number of sectors per track 


00681 


d487 


eS 






inx 




00682 


d488 


c8 






iny 




00683 


d489 


cO 07 






cpy #ctbsiz 


have we done 7? 


00684 


d48b 


dO f4 






bne sets40 


not yet 


00685 


d48d 












00686 


d48d 












00687 


d48d 


===> Set 1 


up Power 


On error message <= 


00688 


d48d 












00689 


d48d 


a9 73 




seterr 


Ida #cbmv2 


ID mismatch 


00690 


d48f 


20 d7 


d9 




jsr errtsO 


error handling 


00691 


d492 












00692 


d492 












00693 


d492 


==> Power On bump <= 




00694 


d492 












00695 


d492 






ponbmp 






00696 


d492 


a9 01 






Ida #1 


track I 


00697 


d494 


8d 23 


10 




sta $1023 


HDRS 


00698 


d497 


8d 2b 


10 




sta $102b 


initialize track in header table 


00699 


d49a 


a9 cO 






Ida #bump 


bump 


00700 


d49c 


8d 03 


10 




sta $1003 


drive 


00701 


d49f 


a9 cl 






Ida #bump+l 


bump 


00702 


d4al 


8d 04 


10 




sta $1004 


drive 1 


00703 


d4a4 


8d 87 


02 




sta atnpe 


allow ATN to interrupt 


00704 


d4a7 












00705 


d4a7 












00706 


d4a7 


»==> Running idle 


, waiting for 


something to do <-== 


00707 


d4a7 












00708 


d4a7 


ad 47 


43 


idle 


Ida cmdwat 


if no command waiting, 


00709 


d4aa 


£0 Oc 






beq idle2 


Test for drive running or open 


00710 


d4ac 


78 






sei 




00711 


d4ad 


a9 00 






Ida #0 




00712 


d4af 


8d 47 43 




sta cmdwat 


command waiting flag 


00713 


d4b2 


8d f2 


10 




sta nmiflg 


clear debounce 


00714 


d4b5 


20 5b db 




jsr parsxq 


Parse & execute string in command 














buffer 


00715 


d4b8 












00716 


d4b8 












00717 


d4b8 













diskint, idle 






line 


addr 


object 


source code 


00718 


d4b8 


===> Test 


for drive runnina or 


00719 


d4b8 








00720 


d4b8 


58 


idle2 


cli 


00721 


d4b9 


a9 Oe 




Ida #14 


00722 


d4bb 


85 07 




sta t3 


00723 


d4bd 


a9 00 




Ida #0 


00724 


d4bf 


85 04 




sta temp 


00725 


d4c1 


85 05 




sta tl 


00726 


d4c3 


a6 07 


fileOl Idx t3 


00727 


d4c5 


b5 a2 




Ida llntab.x 


00728 


d4c7 


c9 ff 




cmp #$ff 


00729 


d4c9 


fO 10 




beq file02 


00730 


d4cb 


29 3f 




and #%0011111 


00731 


d4cd 


85 15 




sta lindx 


00732 


d4cf 


20 95 fa 




jsr getact 


00733 


d4d2 


aa 




tax 


00734 


d4d3 


bd 4e 43 




Ida 1st job, X 


00735 


d4d6 


29 01 




and #1 


00736 


d4d8 


aa 




tax 


00737 


d4d9 


f6 04 




inc temp.x 


00738 


d4db 


c6 07 


file02 


! dec t3 


00739 


d4dd 


10 e4 




bpl flleOl 


00740 


d4df 


aO Ob 


tstfil 


. Idy #bfcnt-l 


00741 


d4e1 


b9 03 10 


fil5 


Ida jobs.y 


00742 


d4e4 


10 05 




bpl fil6 


00743 


d4e6 


29 01 




and #1 


00744 


d4e8 


aa 




tax 


00745 


d4e9 


f6 04 




inc temp.x 


00746 


d4eb 


88 


fil6 


dey 


00747 


d4ec 


10 f3 




bpl fil5 


00748 


d4ee 


ad 82 02 




Ida pbd2 


00749 


d4fl 


29 e7 




and #255-ledl- 


00750 


d4£3 


48 




pha 


00751 


d4f4 


a5 04 




Ida temp 


00752 


d4f6 


fO 04 




beq fil03 


00753 


d4f8 


68 




pla 


00754 


d4f9 


09 10 




ora #%10000 


00755 


d4fb 


48 




pha 


00756 


d4fc 


a5 05 


fil03 


Ida tl 


00757 


d4fe 


fO 04 




beq fil04 


00758 


dSOO 


68 




pla 


00759 


d501 


09 08 




ora #%1000 


00760 


d503 


48 




pha 


00761 


d504 


68 


fil04 


pla 



page 



.17 



open <==. 

allow interrupts 

highest possible SA for files 

if file open, turn on active LED 



current status SA 

look for an active file. FF means 

none 

1 active file found, so AND and store 
result as 

the current channel number 
Get active buffer number 

find out which drive it is on 

and store in .X 

then add to the count of active 

files on drive X 

set flag indicating drive has file 

open 

if more secondary addresses left to 

check. 

look through job queue for 

Jobs pending 

if bit 7 not set, no job in 

progress. 

mask of the non-drive bits in the 

Job code 

set flag indicating drive is active 

go check more buffers if any left, 
else 

fetch data byte from port 
controlling LED 
■ledO 

test active file count on drive 

turn on LED if drive flag 
if not 

test active file count on drive 1 



dlskint, Idle page ...18 

line addr object source code 

00762 d505 8d 82 02 sta pbd2 

00763 d508 4c bS d4 jmp idle2 back to top of loop 

00763 d50b 

00764 d50b .lib ieee 



page 



.19 



line addr object source code 



00766 

00767 

00768 

00769 

00770 

00771 

00772 

00773 

00774 

00775 

00776 

00777 

00778 

00779 

00780 

00781 

00782 

00783 

00784 

00785 

00786 

00787 

00788 

00789 

00790 

00791 

00792 

00793 

00794 

00795 

00796 

00797 

00798 

00799 

00800 

00801 

00802 

00803 

00804 

00805 

00806 

00807 

00808 

00809 

00810 

00811 

00812 
00813 
00814 
00815 
00816 
00817 



dSOb 

d50b 

dSOb 

d50d 

d50e 

d511 

d513 

d516 

d519 

d51b 

dSle 

d520 

d523 

d526 

d529 

d52b 

d52d 

d52f 

d531 

d534 

d537 

d539 

d53b 

d53e 

d540 

d542 

d544 

d547 

d54a 

d54c 

d54e 

d550 

d552 

d554 

d556 

d558 

d55a 

d55c 

d55e 

d560 

d562 

d564 

d566 

d568 

d56a 

d56c 

d56f 
d56f 
d571 
d573 
d575 
d577 



===> Main system IRQ routine - IRQ vector points here <=== 



a2 ff 
9a 

ad 87 02 
a9 18 
Od 80 02 
8d 80 02 
a9 ff 
8d 02 02 
a9 07 
Od 80 02 
8d 80 02 
2c 80 02 
50 04 
30 f9 
10 7b 
a9 fb 
2d 80 02 
8d 80 02 
29 20 
85 aO 
ad 00 02 
49 ff 
85 18 
a9 fd 
2d 80 02 
8d 80 02 
aO 00 
a5 18 
29 60 
c9 40 
fO 29 
c9 20 
fO 06 
c9 60 
fO 2f 
dO 44 
a5 18 
c5 Oc 
fO Ob 
c9 3f 
dO 02 
84 Oe 
84 10 
4c a2 d5 



85 Oe 

84 Of 
a9 20 

85 16 
85 17 



atnIO 



atn20 



atn30 



atnirq Idx #$ff 

txs 

Ida atnpe 

Ida #davo-i«oio 

era pad2 

sta pad2 

Ida #$ff 

sta ieeedo 

Ida Idaco+rfdofatna 

ore pad2 

sta pad 2 

bit pad2 

bvc atn30 

bmi atn20 

bpl atn50 

Ida #$ff-rfdo 

and pad2 

sta pad2 

and #eoil 

sta eoiflg 

Ida ieeedi 

eor #$ff 

sta data 

Ida #$ff-daco 

and pad2 

sta pad2 

Idy #0 

Ida data 

and #%01 100000 

cmp #$40 

beq dcde60 

cmp #$20 

beq dcde20 

cmp #$60 

beq dcde70 

bne atn40 
dcde20 Ida data 

cmp Isnadr 

beq dcde40 

cmp #unlsn 

bne dcde30 

sty Isnact 
dcde30 sty adrsed 

Jmp atn40 



dcde 



dcde40 sta Isnact 
sty tlkact 

dcde50 Ida #32 
sta sa 
sta orgsa 



clear the stack 

clear IRQ flag 

free control lines 
send out DAV & EOI 

free data lines 



wait for DAV received 

DAV lo 

ATN lo, ATNI hi 

ATN hi 

NRFD lo 



save EOI 

current EOI status 

IEEE data in, now invert 

this byte and store as 

command 

send NDAC 

and send it 

temporary data byte 
mask bits 5 and 6 
talk? 



listen? 



(5) 
(6) 
(5 and 6) 



secondary? 

(note: SA = $60 + N) 
other, so ignore it 
temporary data byte 
listener address 
is mine 



active listener flag 

not primary addressed 

wait for end of DAV, then return to 

main 



active listener flag 
active talker flag 

current secondary address = 
original secondary address 



default 



page 



.20 



line 


addr 


object 


source 


code 




00818 


d579 


85 


10 




sta adrsed 


primary addressed 


00819 


d57b 


dO 


25 




bne atn40 




00820 


d57d 


84 


Of 


dcde60 


sty tlkact 


active talker flag 


00821 


d57f 


a5 


18 




Ida data 


temporary data byte 


00822 


d581 


c5 


Od 




cmp tlkadr 


talker address? 


00823 


d583 


dO 


e5 




bne dcde30 




00824 


d585 


85 


Of 




sta tlkact 


active talker flag 


00825 


d587 


84 


Oe 




sty Isnact 


active listener flag 


00826 


d589 


fO 


e8 




beq dcde50 


always 


00827 


d58b 


a5 


10 


dcde70 


Ida adrsed 


not addressed 


00828 


d58d 


fO 


13 




beq atn40 




00829 


d58£ 


a5 


18 




Ida data 


temporary data byte 


00830 


d591 


85 


17 




sta orgsa 


original secondary address 


00831 


d593 


48 






pha 




00832 


d594 


29 


Of 




and #$0f 


use the lo nibble as 


00833 


d596 


85 


16 




sta sa 


current secondary address 


00834 


d598 


68 






pla 




00835 


d599 


29 


fO 




and #$fO 


mask hi nibble 


00836 


d59b 


c9 


eO 




cmp #$eO 


is it a CLOSE command? 


00837 


d59d 


dO 


03 




bne atn40 


not a CLOSE command 


00838 


d59£ 


20 8d f5 




jsr close 


Close the file related to the 














specified sec. address 


00839 


d5a2 






dcdeSO 




wait for end of DAV 


00840 


d5a2 


2c 


80 02 


atn40 


bit pad2 




00841 


d5a5 


50 


fb 




bvc atn40 




00842 


d5a7 


4c 


1e d5 




Jmp atnlO 


go back for more 


00843 


d5aa 












00844 


d5aa 


a5 


Oe 


atn50 


Ida Isnact 


active listener flag 


00845 


d5ac 


fO 


Of 




beq atn60 


no, we're talking, so send 


00846 


d5ae 


a9 


fa 




Ida #$f£-rfdo-atna NATN, NRFD 


00847 


dSbO 


2d 


80 02 




and pad2 




00848 


d5b3 


8d 


80 02 




sta pad2 




00849 


d5b6 


58 






oil 




00850 


d5b7 


20 


dO d5 




Jsr listen 


open the read channel, send data 


00851 


d5ba 


4c 


a7 d4 




Jmp idle 


then go to idle 


00852 


d5bd 












00853 


d5bd 


a9 


fc 


atn60 


Ida #$ff-atna- 


-daco 


00854 


d5bf 


2d 


80 02 




and pad2 




00855 


d5c2 


8d 


80 02 




sta pad2 




00856 


d5c5 


a5 


Of 




Ida tlkact 




00857 


d5c7 


fO 04 




beq atn70 


if listen mode, go back to idle! 


00858 


d5c9 


58 






cli 




00859 


d5ca 


20 60 d6 




jsr talk 


be an active talker 


00860 


dScd 


4c 


a7 d4 


atn70 


jrap Idle 




00861 


d5d0 












00862 


d5d0 


a9 


04 


listen Ida #rfdo 


RFD: hi 


00863 


d5d2 


Od 


80 02 




ora pad2 




00864 


d5d5 


8d 


80 02 




sta pad2 




00865 


d5d8 


2c 


80 02 


IsnlO 


bit pad2 


DAV: lo 


00866 


d5db 


70 


fb 




bvs IsnlO 


if not, wait 


00867 


d5dd 


20 89 ed 




jsr fndwch 


Find an unused write channel 


00868 


d5e0 










=» earlier releases may have "Idx 
SA" here I 



page 



.21 



line addr object source code 



00869 d5eO bO 05 

00870 d5e2 b5 98 

00871 d5e4 6a 

00872 d5e5 bO 49 

00873 d5e7 a5 17 

00874 d5e9 

00875 d5e9 29 fO 

00876 dSeb c9 fO 



lsnl5 



bcs lsnl5 
Ida chnrdy,x 

ror a 
bcs lsn30 
Ida orgsa 



and #$f0 
cfflp #$f0 



branch If no channel found 

write, read, eoi flags, channel 

status 

OK, open for listen 

if carry set, virite channel inactive 

original secondary address 

=» earlier releases may have "txa" 

here! 

is it an OPEN command? 

see if bits 4 and higher are set. If 

so. 



00877 


d5ed 


fO 41 




beq 


lsn30 


we can expect a filename 


00878 
00879 


dSef 
d5fl 


a5 16 
c9 01 


lsn20 


Ida 
cmp 


sa 

#$01 


current secondary address 
is it a SAVE? 


00880 


d5f3 


fO Oe 


' 


beq lsn25 


Accept all data 


00881 


d5f5 


2c 


80 02 


lsn21 


bit 


pad2 


DAV received? 


00882 


d5f8 


50 


fb 




bvc 


lsn21 




00883 


d5fa 


a9 


fd 




Ida 


#$ff-daco 


send NDAC 


00884 


d5fc 


2d 


80 02 




and 


pad2 




00885 


d5ff 


8d 


80 02 




sta 


pad2 




00886 


d602 


60 






rts 






00887 


d603 














00888 


d603 














00889 


d603 


ssss: 


=> Accept all data • 


C= 




00890 


d603 














00891 


d603 


a9 


fb 


lsn25 


Ida 


#$ff-rfdo 


send NRFD 


00892 


d605 


2d 


80 02 




and 


pad2 




00893 


d608 


8d 


80 02 




sta 


pad2 


RFD lo 


00894 


d60b 


a9 


fd 




Ida 


#$ff-daco 


send NDAC 


00895 


d60d 


2d 


80 02 




and 


pad2 


DAC hi 


00896 


d610 


8d 


80 02 




sta 


pad2 




00897 


d613 


2c 


80 02 


lsn26 


bit 


pad2 


DAV hi received? 


00898 


d616 


50 


fb 




bvc 


lsn26 


if yes, wait, else 


00899 


d618 


a9 


02 




Ida 


#$02 


send DAC 


00900 


d61a 


Od 


80 02 




ora 


pad2 


DAV lo 


00901 


d61d 


8d 


80 02 




sta 


Dad2 




00902 


d620 


a9 04 




Ida #rfdo 


RFD hi 


00903 


d622 


Od 


80 02 




ora 


pad2 


send RFD 


00904 


d625 


8d 


80 02 




sta 


pad2 




00905 


d628 


2c 


80 02 


lsn28 


bit 


pad2 


wait for DAV lo 


00906 


d62b 


50 


fb 




bvc 


lsn28 




00907 


d62d 


4c 


03 d6 




Jap 


lsn25 


do until ATN pulled 


00908 


d630 














00909 


d630 


=ss 


=> data 


received <= 


as 




00910 


d630 














00911 


d630 


a9 


fb 


lsn30 


Ida 


#$ff-rfdo 


send NRFD 


00912 


d632 


2d 


80 02 




and 


pad2 




00913 


d635 


8d 


80 02 




sta 


pad2 




00914 


d638 


29 


20 




and #eoii 


$20 to mask EOI, then save 


00915 


d63a 


85 


aO 




sta 


eoiflg 


current BOI status 


00916 


d63c 


ad 00 02 




Ida 


ieeedi 


IEEE data 


00917 


d63f 


49 


ff 




eor 


#$ff 


inverted becomes 


00918 


d641 


85 


18 




sta data 


temporary data byte 



page 



.22 



line addr object 



source code 



00919 
00920 
00921 
00922 
00923 
00924 
00925 
00926 
00927 
00928 

00929 
00930 
00931 
00932 
00933 
00934 
00935 
00936 
00937 
00938 



00940 
00941 
00942 
00943 
00944 
00945 
00946 
00947 



00949 
00950 
00951 
00952 
00953 
00954 
00955 
00956 
00957 
00958 
00959 
00960 
00961 
00962 
00963 
00964 
00965 
00966 



d643 
d644 
d646 
d649 
d64c 
d64f 
d651 
d653 
d656 
d659 

d65c 
d65d 
d660 
d660 
d660 
d660 
d660 
d663 
d665 
d667 



d66b 
d66c 
d66c 
d66f 
d671 
d673 
d675 
d678 



78 

a9 fd 
2d 80 02 
8d 80 02 
2c 80 02 
50 fb 
a9 02 
Od 80 02 
8d 80 02 
20 fd eb 

58 

4c dO d5 



lsn40 



set 

Ida #$ff-daco 
and pad2 
sta pad 2 
bit pad2 
bvc lsn40 
Ida #$02 
ora pad 2 
sta pad2 
jsr put 



cli 



listen 



==> Talk routines <= 



20 6e ed 
bO 06 
a6 15 
b5 98 



00939 d669 30 01 



60 

2c 82 02 
10 fb 
b5 b5 
49 ff 
8d 02 02 
b5 98 



00948 d67a 09 e7 



d67c 
d67f 
d682 
d685 
d687 
d689 
d68b 
d68e 
d691 
d694 
d694 
d697 
d69a 
d69c 
d69e 
d6a1 
d6a3 
d6a6 



2d 80 02 
8d 80 02 
2c 82 02 
10 Od 
50 f9 
a9 18 
Od 80 02 
8d 80 02 
4c a7 d4 

20 a3 ef 
2c 82 02 
50 fb 
a9 ff 
8d 02 02 
a9 18 
Od 80 02 
8d 80 02 



talk jsr fndrch 
bcs notlk 

talkl Idx llndx 

Ida chnrdfiX 

bml tlklO 

notlk rts 



tlklO bit 
bpl 
Ida 
eor 
sta 
Ida 

ora 

and 
sta 
tlk20 bit 
bpl 
bvc 
Ida 
ora 
sta 
jmp 



send DAC 



DAV received? 
then wait 
send DAC 



put data byte in its proper place 
(DATA, EOI, SA) 

keep on listening 



tlk30 
tlk35 



Find the assigned read channel 

and see if it is active. If not 

logical index, channel number 

write, read, eoi flags, channel 

status 

If READ flag not set, channel not 

ready and 

we're not talking 



set 



pbd2 Wait to receive 

tlklO RFD 

chndat,x channel data byte 

#$ff inverted to 

ieeedo IEEE data out 

chnrdy,x write, read, eoi flags, channel 

status 
#$ff-eoio-davo when 7 set, DAV & EOI ~ 

status ok 



pad2 

pad2 

pbd2 

tlk30 

tlk20 

#davo+eoio 

pad2 

pad2 

idle 



bit 3 «« 0: EOI set 



NRFD? 



Jsr get 
bit pbd2 
bvc tlk35 
Ida #$ff 
sta ieeedo 
Ida #davo+eoio 
ora pad2 
sta pad2 



NDAC? 
NDAV, NEOI 



Get next byte from any type of file 
wait for NDAC 

reset 

IEEE data output register 

send NDAV, NEOI 



page ...23 



line addr object source code 



00967 
00968 
00969 
00970 
00971 
00972 
00973 
00974 

00975 
00976 
00977 
00978 
00979 
00980 
00981 
00982 
00983 
00984 
00985 
00986 

00987 

00988 

00989 

00990 

00991 

00992 

00993 

00994 

00995 

00996 

00997 

00998 

00999 

01000 

01001 

01002 

01003 

01004 

01005 

01006 

01007 

01008 

01009 

01010 

01011 

01012 

01013 

01014 

01015 

01016 



d6a9 
d6ac 
d6ae 
d6bO 
d6b0 
d6bO 
d6b0 
d6bO 

d6b3 
d6b5 
d6b7 
d6b9 
d6bc 
d6be 
d6cO 
d6c2 
d6c4 
d6c5 
d6c6 
d6c7 

d6c9 

d6cb 

d6cd 

d6cf 

d6d1 

d6d3 

d6d5 

d6d7 

d6d9 

d6db 

d6dd 

d6df 

d6e1 

d6e3 

d6e5 

d6e7 

d6e9 

d6ec 

d6ec 

d6ee 

d6fO 

d6f2 

d6f4 

d6£6 

d6f8 

d6fa 

d6fc 

d6fe 

d6fe 

d6fe 



2c 82 02 
70 fb 
50 b5 



tlk40 



bit pbd2 
bvs tlk40 
bvc talkl 



wait for DAV 



===> Find the next available track and sector <= 



20 3e f9 nxtts jsr gethdr 



a9 03 
85 04 
a6 12 
bd eS d2 
85 03 
a9 00 
85 02 
a5 13 
Oa 
Oa 
a8 
bl 02 

dO 33 
a5 13 
c9 12 
£0 16 
90 19 
e6 13 
a5 13 
c9 24 
dO e7 
a9 11 
85 13 
a9 00 
85 14 
c6 04 
dO db 
a9 72 
4c c9 db 

c6 13 
dO d2 
a9 13 
85 13 
a9 00 
85 14 
c6 04 
dO c6 
fO e9 



nxtds 



nxtl 



Ida #$03 
sta temp 
Idx drvnum 
Ida lpbni,x 
sta bmpnt-l-l 
Ida #0 
sta bmpnt 
Ida track 
asl a 
asl a 
tay 
Ida (bmpnt), y 



bne 
Ida 
cmp 
beq 
bcc 
inc 
Ida 
cmp 
bne 
Ida 
sta 
Ida 
sta 
dec 
bne 
nxterr Ida 
jnp 



fndnxt 

track 

#$12 

nxterr 

nxt2 

track 

track 

#maxtrk 

nxtl 

#$11 

track 

#0 

sector 

temp 

nxtl 

#dskful 

cmderr 



nxt2 



dec track 
bne nxtl 
Ida #19 
sta track 
Ida #0 
sta sector 
dec temp 
bne nxtl 
beq nxterr 



set track/sector from most recent 

header 

counter 

temporary work area 

current drive# 

BAM address hi 



bit map pointer 
current track number 



bit map pointer. If <>0 there are no 

free sectors 

Find the next optimum sector 

current track number 

is it the directory track? 

then abort 

(if smaller than 18) 

current track number 

current track number 

36, highest track number 

if unequal, check it out 

current track number 

current sector number 

check if counter 

is zero 

disk is full I 

Command level error handling 

current track number 
check It out if not 

current track number 

current sector number 

check if counter 

is zero 

if it is, report disk full 



page 



.24 



line addr object 



source code 



01017 
01018 
01019 
01020 
01021 
01022 
01023 
01024 
01025 
01026 

01027 
01028 
01029 
01030 



d6£e 
d6fe 
d6fe 
d6fe 
d6fe 
d700 
d701 
d704 
d706 
d708 

d70b 
d70e 
d711 
d713 



01032 
01033 

01034 
01035 
01036 
01037 
01038 
01039 
01040 
01041 
01042 
01043 
01044 
01045 
01046 
01047 
01048 
01049 
01050 
01051 
01052 
01053 
01054 
01055 
01056 
01057 
01058 
01059 
01060 
01061 
01062 
01063 
01064 
01065 



=> Find the next optimum sector <=== 
next sector = current + N (Increment) 
n = normally 10. directory track n ~ 3 



a5 14 

18 

6d 44 43 

85 14 

a5 13 

20 db d7 

8d 3d 43 
8d 3c 43 
c5 14 
bO 12 



01031 d7l5 38 



d716 
d7l8 

d71b 

d71d 

d71f 

d721 

d723 

d725 

d727 

d72a 

d72d 

d72f 

d732 

d734 

d736 

d739 

d739 

d73b 

d73d 

d740 

d742 

d744 

d747 

d747 

d747 

d747 

d749 

d74b 

d74e 

d750 

d751 

d752 

d753 

d755 



a5 14 
ed 3d 43 

85 14 
fO 08 
c6 14 
dO 04 
a9 00 
85 14 
20 95 d7 
20 b1 d7 
bO 15 
ce 3c 43 
10 05 
a9 71 
4c 5c d9 

a5 14 
e6 14 
cd 3d 43 
dO e8 
fO df 
4c 9f eb 



fndnxt Ida sector 
clc 

adc seclnc 
sta sector 
Ida track 
Jsr maxsec 

sta Istsec 
sta cmd 
cop sector 
bcs fndnO 



Ida sector 
sbc Istsec 

sta sector 
beq fndnO 
dec sector 
bne fndnO 
Ida #0 
sta sector 
Jsr avail 
jsr av2 
bcs fndn2 
dec cmd 
bpl fndn5 
Ida #dlrerr 
jmp cmder2 



fndn3 

fndnO 
fndnl 



fndn5 



fndn2 



Ida sector 
inc sector 
cmp Istsec 
bne fndnl 
beq fndn3 
jmp usedts 



current sector number 

sector increment 

current sector number 

current track number 

Tell how many sectors allowed for 

this track 

work area, best sector to do 

temporary Job command 

current sector number 

(if new sector value is less than 

the maximum) 

new sector number is too big, so 

load the 

current sector number 

subtract the maximum sector number 

and store Into 

current sector number 

(if revised sector number is 0) 

current sector number 



current sector number 

Check BAM for available sector 



temporary Job command 
directory error 



current sector number 
current sector number 
best sector to do 



mark track & sector as used 



=> Find best initial track and sector <= 



a9 11 



intts Ida #17 



85 13 

20 89 d7 

a5 13 loop 

Oa 

Oa 

a8 

bl 02 

dO 15 



sta track 

jsr setbmp 

Ida track 

asl a 

asl a 

tay 

Ida (bmpnt),y 

bne fndsec 



current track number 
current track number 



bit map pointer 



page ...25 



line addr object source code 



01066 

01067 

01068 

01069 

01070 

01071 

01072 

01073 

01074 

01075 

01076 

01077 

01078 

01079 

01080 

01081 

01082 

01083 

01084 

01085 

01086 

01087 

01088 

01089 

01090 

01091 

01092 

01093 

01094 

01095 

01096 

01097 

01098 

01099 

01100 

01101 

01102 

01103 

01104 

01105 

01106 

01107 

01108 

01109 

01110 

01111 

01112 

01113 

01114 

01115 

01116 

01117 

01118 



d757 

d759 

d75a 

d75c 

d75d 

d75e 

d75f 

d76t 

d763 

d765 

d767 

d769 

d76c 

d76c 

d76d 

d76e 

d76f 

d771 

d773 

d775 

d778 

d77b 

d77d 

d77£ 

d781 

d783 

d786 

d786 

d789 

d789 

d789 

d789 

d789 

d78b 

d78e 

d790 

d792 

d794 

d795 

d795 

d795 

d795 

d797 

d798 

d799 

d79a 

d79c 

d79e 

d7a0 

d7al 

d7a3 

d7a5 

d7a6 



a9 24 
38 

e5 13 
Oa 
Oa 
a8 

b1 02 
dO 09 
c6 13 
dO e7 
a9 72 
4c c9 db 

98 
4a 
4a 

85 13 
a9 00 
85 14 
20 95 d7 
20 bl d7 
bO 09 
e6 14 
dO f7 
a9 71 
4c 5c d9 



Ida #iiiaxtrk 

sec 

sbc track 

asl a 

asl a 

tay 

Ida (binpnt),y 

bne fndsec 

dec track 

bne loop 

Ida #dskful 

jmp cmderr 



fndsec tya 

Isr a 



fndl 



Isr a 
sta track 
Ida #0 
sta sector 
jsr avail 
Jsr av2 
bcs fnd3 
inc sector 
bne fndl 
Ida #direrr 
Jfflp cmder2 



4c 9£ eb fnd3 jmp usedts 



current track number 

bit map pointer 
current track number 

Comiiand level error handling 
pull original value 

current track number 

current sector number 

Check BAM for available sector 

current sector number 
error in BAM 

mark track & sector as used 



==> Set (indirect) BAM pointer by DRVNUM <= 



a6 12 setbmp Idx drvnum 
bd e8 d2 Ida ipbm.x 
85 03 sta bmpnt+1 

a9 00 Ida #0 

85 02 sta bmpnt 

60 rts 



current drive number 
BAM address hi 



bit map pointer 



=> Check BAM for available sector <== 



a5 13 
Oa 
Oa 
a8 

bl 02 
85 07 
a2 02 
c8 

bl 02 
95 04 
ca 
10 f8 



avail 



avl 



Ida track 

asl a 

asl a 

tay 

Ida ( bmpnt ),y 

sta t3 

Idx #$02 

iny 

Ida ( bmpnt), y 

sta temp,x 

dex 

bpl avl 



current track number 



bit map pointer 



bit map pointer 
temporary work area 



page 



.26 



line 


addr 


object 




source 


code 






01119 


d7a8 


20 bd 


d7 




jsr avck 


check validity of bit map 




01120 


d7ab 


a4 14 






Idy sector 


current sector number 




01121 


d7ad 


fO Od 






beq av4 






01122 


d7af 


dO 02 






bne av3 






01123 


d7bl 


aO 01 




av2 


Idy #$01 






01124 


d7b3 


66 04 




av3 


ror temp 


temporary work area 




01125 


d7b5 


66 05 






ror t1 






01126 


d7b7 


66 06 






ror t2 






01127 


d7b9 


88 






dey 






01128 


d7ba 


dO £7 






bne av3 






01129 


d7bc 


60 




av4 


rts 






01130 


d7bd 














01131 


d7bd 














01132 


d7bd 


==> check 


bit map validity <=== 






01133 


d7bd 














01134 


d7bd 


a2 00 




avck 


Idx #0 






01135 


d7bf 


aO 03 






Idy #$03 


number of bytes 




01136 


d7cl 


dO 06 






bne avck5 


always 




01137 


d7c3 


e8 




avck3 


inx 






01138 


d7c4 


4a 




avck4 


Isr a 






01139 


d7c5 


bO fc 






bcs avck3 






01140 


d7c7 


dO fb 






bne avck4 






01141 


d7c9 


b9 03 00 


avck5 


Ida bmpnt+1 ,y 






01142 


d7cc 


88 






dey 






01143 


d7cd 


10 f5 






bpl avck4 






01144 


d7cf 


e4 07 






cpx t3 


compare bytes free on track as 
BAM 


per 


01145 


d7d1 


fO 07 






beq avck6 






01146 


d7d3 


a9 71 






Ida #direrr 


count doesn't match! 




01147 


d7d5 


aO 00 






Idy #0 






01148 


d7d7 


4c 5c 


d9 




jmp cmder2 






01149 


d7da 


60 




avck6 


rts 






01150 


d7db 














01151 


d7db 


==> Tell 


how many sectors allowed for this track <== 




01152 


d7db 














01153 


d7db 


a2 04 




maxsec 


; Idx #$04 


number of zones counter 




01154 


d7dd 


dd e6 


d7 


maxl 


cmp trknum-1 , x 


zone border value 




01155 


d7e0 


ca 






dex 






01156 


d7e1 


bO fa 






bcs maxl 


track number in .A less than 
boundary value 




01157 


d7e3 


bd 99 


10 




Ida numsec,x 


number of sectors per track this 














zone allows 




01 158 


d7e6 


60 






rts 






01159 


d7e7 














01160 


d7e7 














0U61 


d7e7 


=> Tables used by MAXSEC <= 






01162 


d7e7 














01163 


d7e7 


24 If 


19 


trknum .byte 36,31,25, 


,18 zone border values 




01164 


d7ea 


12 












01164 


d7eb 














01165 


d7eb 








.lib erproc 







error processing, list directory 



page .,.27 



line addr object source code 



01167 


d7eb 


=» 


=> Error Processing <=== 


01168 


d7eb 






01169 


d7eb 
d7eb 







01170 






01171 


d7eb 


Controller errors: 


01172 


d7eb 






01173 


d7eb 





(1 ) no errors 


01174 


d7eb 


20 


(2) can't find block header 


01175 


d7eb 


21 


(3) no sync character 


01176 


d7eb 


22 


(4) data block not present 


01177 


d7eb 


23 


(5) checksum error in data 


01178 


d7eb 


24 


(16) byte decoding error 


01179 


d7eb 


25 


(7) write-verify error 


01 180 


d7eb 


26 


(8) write with write protect on 


01181 


d7eb 


27 


(9) checksum error in header 


01182 


d7eb 


28 


(10) data extends into next block 


01183 


d7eb 


29 


(11) disk ID mismatch 


01184 


d7eb 






01185 


d7eb 


Command errors: 


01186 


d7eb 






01187 


d7eb 


30 


general syntax 


01188 


d7eb 


31 


invalid command 


01189 


d7eb 


32 


long line 


01190 


d7eb 


33 


invalid filename 


01191 


d7eb 


34 


no file given 


01192 


d7eb 






01193 


d7eb 


50 


record not present 


01194 


d7eb 


51 


overflow in record 


01195 


d7eb 


52 


file too large 


01196 


d7eb 






01197 


d7eb 


60 


file open for write 


01198 


d7eb 


61 


file not open 


01199 


d7eb 


62 


file not found 


01200 


d7eb 


63 


file exists 


01201 


d7eb 


64 


file type mismatch 


01202 


d7eb 


65 


no block 


01203 


d7eb 


66 


illegal track or sector 


01204 


d7eb 


67 


illegal system track or sector 


01205 


d7eb 






01206 


d7eb 


70 


no channels available 


01207 


d7eb 


71 


directory error 


01208 


d7eb 


72 


disk full 


01209 


d7eb 


73 


CBM DOS V2 


01210 


d7eb 






01211 


d7eb 


I 


files scratched response 


01212 


d7eb 






01213 


d7eb 


— . 




01214 


d7eb 






01215 


d7eb 


~=: 


> Error codes <== 


01216 


d7eb 






01217 


d7eb 




badsyn = $30 


01218 


d7eb 




badcmd = $31 


01219 


d7eb 




loneln = $32 



error processing, list directory 



page ,..28 



line addr object 



01220 
01221 
01222 
01223 
01224 
01225 
01226 
01227 
01228 
01229 
01230 
01231 
01232 
01233 
01234 
01235 
01236 
01237 
01238 
01239 
01240 
01241 
01242 
01243 
01244 
01245 
01246 
01247 
01248 
01249 
01250 
01251 
01252 
01253 
01254 
01255 
01256 
01257 
01258 
01259 
01260 
01261 
01262 
01263 
01264 
01265 
01266 
01267 
01268 
01269 
01270 
01271 
01272 



d7eb 
d'7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7eb 
d7ee 
d7ef 
d7f2 
d7f5 
d7f8 
d7fa 
d7fd 
dSOO 
d803 
d806 
d809 
d80c 
d80f 
d811 
d814 
d817 
d81a 
dSld 
d81e 
d82t 
d822 
d825 
d828 
d82b 
d82e 
d82f 
d832 
d835 



source code 

badfn = $33 

nofile » $34 

norec = $50 

recovf « $51 

bigfil - $52 

filopn = $60 

fllnop > $61 

flntfd - $62 

flexst - $63 

ffllstyp " $64 

noblk - $65 

badts <• $66 

nochnl = $70 

direrr = $71 

dskful = $72 

cbiiiv2 » $73 



==> Error Message Table <= 

leading error numbers, text with 1st & last characters 

ORed with $80, 

tokens for key words are less than $10 (ANDed with $80) 



00 aO 4f 

cb 

20 21 22 

23 24 27 

d2 45 41 

44 89 

52 83 20 
54 4f 4£ 
20 4c 41 
52 47 c5 

50 8b 06 
20 50 52 

45 53 45 
4e d4 

51 of 56 
45 52 46 
4c 4f 57 
20 49 4e 
8b 

25 28 8a 
89 

26 8a 20 
50 52 4f 
54 45 43 
54 20 4f 
ce 

29 88 20 
49 44 85 

30 31 32 



errtab .byte $00, $aO, 'oK' 

•byte $20, $21, $22, $23, $24, $27, 'Read', $89 

.byte $52, $83, ' too largE' 

•byte $50, $8b, $06,' presenT' 

.byte $51, 'Overflow in', $8b 

.byte $25, $28, $8a, $89 write error 
.byte $26, $8a, ' protect oN' 

.byte $29, $88, ' id', $85 

.byte $30, $31, $32, $33, $34 syntax error 



error processing, list directory 



page 



.29 



line addr object source code 



01273 

01274 

01275 

01276 

01277 

01278 

01279 

01280 

01281 

01282 

01283 

01284 

01285 

0T286 

01287 

01288 

01289 

01290 

01 291 

01292 

01293 

01294 

01295 

01296 

01297 

01298 

01299 

01300 

01301 

01302 

01303 

01304 

01305 

01306 

01307 

01308 

01309 

01310 

01311 

01312 

01313 

01314 

01315 

01316 

01317 

01318 

01319 

01320 

01321 

01322 

01323 

01324 

01325 



d838 

d83a 

d83d 

d840 

d841 

d844 

d845 

d848 

d84b 

d84e 

d85l 

d854 

d856 

d859 

d85c 

d85f 

d862 

d865 

d868 

d86b 

d86e 

d871 

d874 

d877 

d878 

d87b 

d87c 

d87f 

d880 

d883 

d886 

d889 

d88c 

d88d 

d890 

d893 

d896 

d898 

d89b 

d89d 

d8a0 

d8a3 

d8a4 

d8a7 

d8aa 

dSad 

dSaf 

d8af 

dSaf 

d8af 

dSaf 

dSaf 

d8b2 



33 34 
d3 59 4e 
54 41 58 
89 

60 8a 03 
84 

63 83 20 
45 58 49 

53 54 d3 

64 83 20 

54 59 50 
45 85 

65 ce 4f 
20 42 4c 
4f 43 cb 

66 67 c9 
4c 4c 45 
47 41 4c 
20 54 52 
41 43 4b 
20 4f 52 
20 53 45 
43 54 4f 
d2 

61 83 06 
84 

62 83 06 
87 

01 83 53 
20 53 43 
52 41 54 
43 48 45 
c4 

70 ce 4f 
20 43 48 
41 4e 4e 

45 cc 

71 c4 49 
52 89 

72 88 20 

46 55 4c 
cc 

73 c3 42 
4d 20 44 
4f 53 20 
56 b2 



.byte 'Syntax', $89 

•byte $60, $8a, $03, $84 write file open 
.byte $63, $83, ' existS' 

.byte $64, $83, ' type', $85 

.byte $65, 'No blocK' 

.byte $66, $67, 'Illegal track or sectoR' 



.byte $61, $83, $06, $84 file not open 

.byte $62, $83, $06, $87 file not found 

.byte $01, $83, 's scratcheD' 

.byte $70, 'No channeL' 

•byte $71, 'Dir', $89 

.byte $72, $88, ' fulL' 

.byte $73, 'Cbm dos v', $b2 CBM DOS V2 



==> Error token keywords used more than once <=== 

errtok = *-errtab 

09 c5 52 .byte $09, 'ErroR' 
52 4f d2 



error 


processing 


;, list 


directory 






line 


addr 


object 


source 


code 






01326 


d8b5 


Oa 


d7 52 




.byte $0a, 


'WrltE 


t 


01327 


d8b8 


49 


54 c5 










01328 


dSbb 


03 


c6 49 




.byte $03, 


'FilE' 




01329 


dSbe 


4c 


c5 










01330 


dScO 


04 


cf 50 




.byte $04, 


•OpeN' 




01331 


d8c3 


45 


ce 










01332 


d8c5 


05 


cd 49 




.byte $05, 


•MismatcH' 


01333 


d8c8 


53 4d 41 










01334 


dScb 


54 43 c8 










01335 


dSce 


06 


ce 4f 




.byte $06, 


•NoT' 




01336 


d8dl 


d4 












01337 


d8d2 


07 


c6 4f 




.byte $07, 


'FounE 


i' 


01338 


d8d5 


55 4e c4 










01339 


d8d8 


08 


c4 49 




.byte $08, 


'DisK' 




01340 


d8db 


53 


cb 










01341 


dSdd 


Ob d2 45 




.byte $0b. 


'RecorD' 


01342 


d8e0 


43 


4f 52 










01343 


d8e3 


c4 












01344 


d8e4 














01345 


d8e4 






errend 


= *-errtab 






01346 


d8e4 














01347 


d8e4 














01348 


d8e4 


= 


=> Recursive error message 


routine <= 


01349 


d8e4 














01350 


d8e4 


dd 


eb d7 


moverr 


cmp err tab. 


x 


A = BCD error numb< 


01351 


d8e7 


fO 06 




beq iBer5 






01352 


d8e9 


68 






inx 






01353 


dSea 


eO 


f9 




cpx #$f9 






01354 


d8ec 


90 


f6 




bcc moverr 






01355 


d8ee 


60 






rts 






01356 


d8e£ 














01357 


dSef 


e8 




mer5 


Inx 




skip past error nui 


01358 


dSfO 


bd 


eb d7 




Ida err tab, 


,x 




01359 


d8f3 


10 


fa 




bpl merS 






01360 


d8f5 


29 


7f 




and #$7f 






01361 


d8f7 


c9 


10 


mer6 


cmp #$10 






01362 


d8f9 


90 


15 




bcc mer70 




token 


01363 


dSfb 


91 


47 




sta (cb+2), 


.y 


so store character 


01364 


dSfd 


c8 






iny 






01365 


d8fe 


e8 




mer65 


inx 






01366 


d8ff 


bd 


eb d7 




Ida err tab, 


,x 




01367 


d902 


10 


f3 




bpl mer6 






01368 


d904 


48 






pha 




last character 


01369 


d905 


29 


7f 




and #$7f 






01370 


d907 


c9 


ro 




cmp #$10 






01371 


d909 


90 06 




bcc mer7 




token 


01372 


d90b 


91 


47 




sta (cb+2) 


• y 




01373 


d90d 


c8 






iny 






01374 


d90e 


68 






pla 






01375 


d90f 


60 






rts 






01376 


d910 














01377 


d910 


48 




mer70 


pha 




token process 


01378 


d91l 


48 




mer7 


pha 







page 



.30 



error processing, list directory 



page 



.31 



line addr object source code 



01379 

01380 

01381 

01382 

01383 

01384 

01385 

01386 

01387 

01388 

01389 

01390 

01391 

01392 

01393 

01394 

01395 

01396 

01397 

01398 

01399 

01400 

01401 

01402 

01403 

01404 

01405 

01406 

01407 

01408 

01409 

01410 

01411 

01412 

01413 

01414 

01415 

01416 

01417 

01418 

01419 

01420 

01421 

01422 

01423 

01424 

01425 



d912 

d914 

d916 

d917 

d918 

d91a 

d91c 

d91f 

d921 

d922 

d924 

d925 

d925 

d925 

d925 

d925 

d925 

d925 

d925 

d926 

d928 

d929 

d92a 

d92b 

d92c 

d92d 

d930 

d932 

d935 

d937 

d938 

d93a 

d93c 

d93e 

d940 

d941 

d942 

d943 

d944 

d945 

d948 

d94a 

d94c 

d94e 

d951 

d952 

d955 



a9 20 

91 47 

c8 

68 

86 07 

a2 c4 

20 e4 d8 

a6 07 

68 

10 da 

60 



Ida #$20 

sta (cb+2),y 

iny 

pla 

stx t3 

Idx #$c4 

jsr mover r 

Idx t3 

pla 

bpl iner65 

rts 



implied leading space 



recursive for tokens 



===> Handle errors reported by controller <=== 



•A = error number 
.X = job# 

48 error pha 

86 al stx 

8a txa 

Oa asl 

Oa asl 

Oa asl 

aa tax 

bd 23 10 Ida 

85 13 sta 

bd 24 10 Ida 

85 14 sta 

68 pla 

29 Of and 

dO 02 bne 

a9 06 Ida 
09 20 errl era 

aa tax 

ca dex 

ca dex 

8a txa 

48 pha 

ad 7a 43 Ida 

c9 01 cmp 

dO Of bne 

a9 ff Ida 

8d 7a 43 sta 

68 pla 

20 dd d9 jsr 

20 ff ec jsr 



Jobnum 

a 
a 
a 

hdrs+2,x 
track 
hdrs+3,x 
sector 

#$0f 
errl 
#$06 
#$20 



cmdnum 

#$01 

err2 

#$ff 

cmdnum 



errmsg 
initdr 



01426 d958 

01427 d95b 

01428 d95b 

01429 d95c 

01430 d95f 



4c 5f d9 

68 

20 dd d9 

20 be db 



jmp ciader3 

err2 pla 
cmder2 jsr errmsg 
cmder3 jsr clrcb 



save error code 

job number in .X 

as error number 

multiply 

by 

8 

set track 

current track# 

and sector 

current sector# 

convert EC from disk controller 

to DOS code ready for output 

if 0, handle codes 16-20 

6 ORed with $20 then 2 subtracted 



marks code for output 

save DOS error code to stack 

command # 

open or validate? 

no 

set command number to 255 

pull error code from stack and 

transfer to error buffer 

initialize drive and eliminate bad 

BAM 

complete the error handling 

pull DOS code off stack 
transfer code to error buffer 
Clear command buffer 



error processing, list directory 



page 



.32 



line 


addr 


ob; 


ject 




source 


code 




01431 


d962 


a9 


00 






Ida #0 


clear error flag — tell DOS not to 
write bad 


0U32 


d964 


8d 


73 


43 




sta erword 


BAM copy to disk 


01433 


d967 


ad 


82 


02 




Ida pbd2 


set error TiF.D red 


01434 


d96a 


09 


20 






ora #errled 




01435 


d96c 


8d 


82 


02 




sta pbd2 




01436 


d96f 


20 


d3 


fO 




jsr freich 


Free internal channels LI 7 & LI 8 


01437 


d972 


a9 


00 






Ida #0 


clear pointers 


01438 


d974 


85 


45 






sta cb 


in command buffer 


01439 


d976 


a2 


ff 






Idx #$ff 




01440 


d978 


9a 








txs 


reset stack 


01441 


d979 


a5 


17 






Ida orgsa 


mask bits 0-3 


01442 


d97b 


29 


If 






and f$1f 


mark as 


01443 


d97d 


85 


16 






sta sa 


current secondary address 


01444 


d97f 


c9 


Of 






cmp #cmdsa 


command channel =15? 


01445 


d981 


fO 


2b 






beq err 10 


yes 


01446 


d983 


78 








sel 


no interrupsl 


01447 


d984 


a5 


Oe 






Ida Isnact 


if listen active flag not 0, we are 


01448 


d986 


dO 


11 






bne Isnerr 


an 

active listener, else 


01449 


d988 


a5 


Of 






Ida tlkact 


if no here. 


01450 


d98a 


fO 


22 






beq errlO 


we're an active talker, so do next 
routine 


01451 


d98c 














01452 


d98c 














01453 


d98c 


sss 


»> Talker error 


recovery <== 




01454 


d98c 




if command channel, release 


: DAV 


01455 


d98c 




if data channel, force not 


ready and release channel 


01456 


d98c 














01457 


d98c 


20 6e 


ed 


tlkerr 


jsr fndrch 


find an unused read channel 


01458 


d98f 


ad 


80 02 




Ida pad2 


IEEE control port 


01459 


d992 


09 


10 






ora #davo 


DAV 


01460 


d994 


8d 


80 02 




sta pad2 


out 


01461 


d997 


dO Od 






bne tlerr 


bra 


01462 


d999 














01463 


d999 














01464 


d999 


sss: 


=> Listener error recovery <= 


[=S 


01465 


d999 




if command channel, release 


. RFD 


01466 


d999 




if data channel, force not 


ready and release channel 


01467 


d999 














01468 


d999 


20 


89 


ed 


Isnerr 


jsr fndwch 


find an unused read channel 


01469 


d99c 


a9 


04 






Ida #rfdo 


RFD 


01470 


d99e 


Od 


80 02 




ora pad2 


IEEE control port 


01471 


d9al 


29 


fe 






and #$fe 


ATN lo 


01472 


d9a3 


8d 


80 02 




sta pad2 


out 


01473 


d9a6 


20 


a6 


ed 


tlerr 


Jsr typfil 




01474 


d9a9 


bO 


03 






bcs err 10 


if direct access 


01475 


d9ab 


20 


a4 


ee 




jsr frechn 


close channel 


01476 


d9ae 


4c a7 


d4 


errlO 


jmp Idle 


and twiddle your thumbs a while 1 


01477 


d9bl 














01478 


d9bl 















error processing, list directory 



page .,.33 



line addr object source code 



01479 

01480 

01481 

01482 

01483 

01484 

01485 

01486 

01487 

01488 

01489 

01490 

01491 

01492 

01493 

01494 

01495 

01496 

01497 



d9bl 

d9bl 

d9bl 

d9b2 

d9b4 

d9b5 

d9b7 

d9b9 

d9ba 

d9bc 

d9bd 

d9c0 

d9cO 

d9cl 

d9cl 

d9c1 

d9cl 

d9cl 

d9c2 



01498 d9c3 

01499 d9c4 

01500 d9c5 

01501 d9c6 



01502 
01503 
01504 
01505 
01506 
01507 
01508 
01509 
01510 
01511 
01512 
01513 
01514 
01515 
01516 
01517 
01518 
01519 
01520 
01521 
01522 

01523 
01524 
01525 
01526 
01527 



d9c9 

d9ca 

d9cc 

d9ce 

d9dO 

d9dl 

d9d2 

d9d2 

d9d2 

d9d2 

d9d2 

d9d5 

d9d7 

d9d9 

d9db 

d9dd 

d9df 

d9el 

d9e3 

d9e5 

d9e7 

d9ea 
d9ec 
d9ee 
d9ef 
d9f2 



==> Convert hex to bed <= 



aa 

a9 00 

f8 

eO 00 

fO 07 

18 

69 01 

ca 

4c b5 d9 

d8 



hexdec tax 

Ida #0 



hexO 



sed 

cpx #0 

beq hex5 

clc 

adc #$0l 

dex 

jmp hexO 



hex5 eld 



==> Convert bed to ascii <=== 

aa bcddec tax 
^a isr a 



4a 
4a 
4a 
20 ca d9 

8a 

29 Of 
09 30 
91 47 
c8 
60 



bcd2 



Isr a 
Isr a 
Isr a 
jar bed 2 

txa 

and #$0f 

ora #$30 

sta (cb+2),y 

Iny 

rts 



transfer hex T & S 

set decimal mode 

Convert bed to ascii 
add (X) times 



clear decimal mode 



packed figure 

mask tenths — divide BCD value by 

16 



convert MSB to ASCII and transfer to 

error buffer 

same with ones 

mask off the higher order nibble 

to convert to ASCII 

this now contains ASCII number 

.X still contains BCD number 



===> Transfer error message to error buffer <== 



20 4b da 
a9 00 
aO 00 
84 13 

84 14 
aO 00 
a2 de 
86 47 
a2 43 
86 48 

20 cl d9 

a9 2c 

91 47 

e8 

ad de 43 

85 be 



okerr jsr 
Ida 

errtsO Idy 
sty 
sty 

errmsg Idy 
Idx 
stx 
Idx 
stx 
jsr 

Ida 
sta 
iny 
Ida 
sta 



erroff 

#0 

#0 

track 

sector 

#0 

#<errbuf 

eb+2 

#>errbuf 

eb+3 

bcddec 

(cb+2),y 



error LED green 
no error 
set 

track & 
sector to 

pointer to error buffer 



convert error number and store at 
start of error buffer 



store 



after error message 



in error buffer 
points into error buffer 
errbuf copy 1st digit from error buffer 
chndat+errehn to output register (channel 
data area) 



error processing, list directory 



page ...34 



line 


addr 


object 




source 


code 




01528 


d9f4 


8a 






txa 


error number In .X 


01529 


d9f5 


a2 00 






Idx #0 




01530 


d9f7 


20 e4 


d8 




jsr mover r 


move error message to buffer 


01531 


d9fa 


a9 2c 




ernisg2 Ida #',' 


store "," 


01532 


d9fc 


91 47 






sta (cb+2),y 


in error buffer after error message 


01533 


d9fe 


c8 






iny 


points into error buffer 


01534 


d9ff 


a5 13 






Ida track 


convert track 


01535 


daOl 


20 bl 


d9 




Jsr hexdec 


to bed 


01536 


da04 


a9 2c 






Ida #*,' 




01537 


da06 


91 47 






sta (cb+2),y 




01538 


da08 


c8 






iny 




01539 


da09 


a5 14 






Ida sector 


convert sector 


01540 


daOb 


20 bl 


d9 




Jsr hexdec 


to bed 


01541 


daOe 


88 






dey 


point to last character 


01542 


daOf 


98 






tya 




01543 


dalO 


18 






ele 




01544 


dall 


69 dc 






adc #<errbuf 


add start address lo of error buffei 


01545 


dal3 


85 c4 






sta Istchr+errchn store as end pointer 


01546 


dal5 


e6 47 






inc eb+2 


Increment error buffer pointer 


01547 


dal7 


a9 88 






Ida #rdytlk 


indicate ready-to-talk error channe: 
status 


01548 


dal9 


85 9f 






sta chnrdy+errchn set read flag, reset EOI 


01549 


dalb 


60 






rts 




01550 


dale 












01551 


dale 












01552 


dale 


=> 


Mark 


track and sector as free in BAM <=== 


01553 


dale 












01554 


dale 


20 89 


d7 


frets 


jsr setbinp 


point BMPNT at BAM 


01555 


dalf 


20 b4 


eb 




jsr f reuse 


Calculate BAM index for FRETS and 
USEDTS 


01556 


da22 


38 






see 


flag for no action 


01557 


da23 


dO Of 






bne frerts 


free already 


01558 


da25 


bl 02 






Ida (bmpnt),y 


not free — free it 


01559 


da27 


Id ee 


eb 




ora biiiask,x 


BAM mask bytes 


01560 


da2a 


91 02 






sta (bmpnt),y 


bit map pointer 


01561 


da2e 


a4 04 






Idy temp 


index to free sectors counter 


01562 


da2e 


bl 02 






Ida (bmpnt),y 


add one (C=l) 


01563 


da30 


69 00 






ade #0 




01564 


da32 


91 02 






sta (bnipnt),y 


bit map pointer 


01565 


da34 


60 




frerta 


rts 




01566 


da35 












01567 


da35 












01568 


da35 


=•=> Turn 


LED on/off for current 


drive <= 


01569 


da35 












01570 


da35 


a9 e7 




setlds Ida #$e7 




01571 


da37 


2d 82 02 




and pbd2 




01572 


da3a 


48 






pha 




01573 


da3b 


a5 12 






Ida drvnum 


current drive 


01574 


da3d 


fO 05 






beq ledsO 




01575 


da3f 


68 






pla 




01576 


da40 


09 08 






ora #ledl 




01577 


da42 


dO 03 






bne ledsl 




01578 


da44 


68 




ledsO 


pla 





error processing, list directory 



page 



.35 



line addr object source code 



01579 

01580 

01581 

01582 

01583 

01584 

01585 

01586 

01587 

01588 

01589 

01590 

01591 

01592 

01593 

01594 

01595 

01596 

01597 
01598 
01599 
01600 
01601 
01602 
01603 
01604 
01605 
01606 
01607 
01608 

01609 
01610 
01611 
01612 
01613 
01614 
01615 
01616 
01617 
01618 
01619 
01620 
01621 
01622 
01623 
01624 
01625 
01626 
01627 
01628 



da45 
da47 
da4a 
da4b 
da4b 
da4e 
da50 
da53 
da54 
da54 
da54 
da54 
da54 
da56 
da58 
da5a 
da5d 
da5f 

da62 
da64 
da66 
da68 
da6b 
da6c 
da6e 
da71 
da73 
da76 
da78 
da7b 

da7d 
daSO 
da83 
da86 
da89 
daSb 
da8e 
da91 
da94 
da95 
da96 
da98 
da9a 
da9c 
da9f 
daal 
daa4 
daa? 
daaa 
daac 



09 10 
8d 82 02 
60 

ad 82 02 
29 df 
8d 82 02 
60 



ledsl 



ora #ledO 
3ta pbd2 
rts 



erroff Ida pbd2 

and #$ff-errled 

sta pbd2 

rts 



turn off error LED 



=> Start directory loading function; get buffer first <== 



a9 00 
85 16 
a9 01 
20 63 ee 
a9 00 
20 cl fO 

a6 15 
a9 00 
95 bd 
20 95 fa 
aa 

a5 12 
9d 4e 43 
a9 01 
20 b6 ec 
a9 04 
20 b6 ec 
a9 01 

20 b6 ec 
20 b6 ec 
ad 77 43 
20 b6 ec 
a9 00 
20 b6 ec 
20 Oc db 
20 95 fa 
Oa 
aa 

d6 29 
d6 29 
a9 00 
20 b6 ec 
a9 01 
20 b6 ec 
20 b6 ec 
20 c9 eO 
90 2c 
ad 77 43 



stdir 



dirl 



Ida #0 
sta sa 
Ida #$01 
jsr getrch 
Ida #0 
Jsr setpnt 

Idx lindx 
Ida #0 
sta Istchr.x 
jsr getact 
tax 

Ida drvnuo 
sta Istjob.x 
Ida #$01 
jsr putbyt 
Ida #$04 
jsr putbyt 
Ida #$01 



jar 
jsr 
Ida 
Jar 
Ida 
jsr 
jsr 
Jsr 
asl 
tax 
dec 
dec 
Ida 
jsr 
Ida 
jsr 
jsr 
jsr 
bcc 
Ida 



putbyt 

putbyt 

nbtemp 

putbyt 

#0 

putbyt 

movbuf 

getact 



buftab,x 

buftab,x 

#0 

putbyt 

#$01 

putbyt 

putbyt 

getnam 

dir3 

nbtemp 



current secondary address 
allocate channel and 1 buffer 
open a new read channel 

Set up pointer into active data 

buffer 

logical index, channel number 

channel last character pointer 
Get active buffer number 

current drive 
last job by buffer 
put SAL in buffer 

put SAH in buffer 

insert phoney program line links 
($0101) 



temporary number of blocks 
put in DRVNUM 

store as hi byte of line mumber 

get disk name name into buffer 

and active buffer number 

multiply by 2 

and store in .X, then decrement 

buffer pointer lo 

twice 

end-of-line null byte 

Insert phoney links 



Get number of buffers and file name 
test if last entry 
number of temp, blocks, use as lo 
line number byte 



error 


processing, list 


directory 


line 


addr 


object 


source 


: code 


01629 


daaf 


20 


b6 ec 




jsr putbyt 


01630 


dab2 


ad 


78 43 




Ida nbtemp+l 


01631 


dab5 


20 


b6 ec 




jsr putbyt 


01632 


dabS 


20 Oc db 




jsr movbuf 


01633 


dabb 


a9 


00 




Ida #0 


01634 


dabd 


20 


b6 ec 




jsr putbyt 


01635 


dacO 


dO 


dd 




bne dirl 


01636 


dac2 


20 


95 fa 


dirlO 


jar getact 


01637 


dac5 


Oa 






asl a 


01638 


dac6 


aa 






tax 


01639 


dac7 


a9 


00 




Ida #0 


01640 


dac9 


95 


29 




sta buftab.x 


01641 


dacb 


a9 


88 




Ida #rdytlk 


01642 


dacd 


a4 


15 




Idy lindx 


01643 


dacf 


8d 


46 43 




sta dirlst 


01644 


dad2 


99 


98 00 




sta chnrdy.y 


01645 


dad5 


a5 


18 




Ida data 


01646 


dad7 


60 






rts 


01647 


dadS 










01648 


dad8 


ad 


77 43 


dir3 


Ida nbtemp 


01649 


dadb 


20 


b6 ec 




jsr putbyt 


01650 


dade 


ad 


78 43 




Ida nbtemp+l 


01651 


dael 


20 


b6 ec 




Jsr putbyt 


01652 


dae4 


20 Oc db 




jar movbuf 


01653 


dae7 


20 


95 fa 




jsr getact 


01654 


daea 


Oa 






asl a 


01655 


daeb 


aa 






tax 


01656 


daec 


d6 


29 




dec buftab.x 


01657 


daee 


d6 


29 




dec buftab,x 


01658 


dafO 


a9 


00 




Ida #0 


01659 


daf2 


20 


b6 ec 




jsr putbyt 


01660 


dafS 


20 


b6 ec 




jsr putbyt 


01661 


daf8 


20 


b6 ec 




jsr putbyt 


01662 


dafb 


20 


95 fa 




jsr getact 


01663 


dafe 


Oa 






asl a 


01664 


daff 


a8 






tay 


01665 


dbOO 


b9 


29 00 




Ida buftab,y 


01666 


db03 


a6 


15 




Idx lindx 


01667 


db05 


95 


bd 




sta Istchr.x 


01668 


db07 


d6 


bd 




dec Istchr.x 


01669 


db09 


4c c2 da 




jmp dirlO 


01670 


dbOc 










01671 


dbOc 










01672 


dbOc 


SIB» 


>> Transfer filename to list: 


01673 


dbOc 










01674 


dbOc 


aO 


00 


movbuf Idy #0 


01675 


dbOe 


b9 


b4 41 


movbl 


Ida nambuf.y 


01676 


dbU 


20 


b6 ec 




jsr putbyt 


01677 


dbl4 


c8 






iny 


01678 


dbl5 


cO 


lb 




cpy #nbsiz 


01679 


dbl7 


dO 


f5 




bne movbl 



page ...36 



hi line number byte 

move filename & type into buffer 

end of entry 

if on return the Z flag not set, 

buffer is 

not yet full so do next file entry 

Get active buffer number 



buffer pointer lo 

logical index, channel number 
directory listing flag 
directory list buffer full 
temporary data byte 



this is end of load: line number lo 

line number hi 

mobe filename, type 

Get active buffer number 



buffer pointer lo 
buffer pointer lo 
end of listing (000) 



Get active buffer number 



buffer pointer lo 
logical index, channel number 
channel last character pointer 
pointer to last character in buffer 
set channel status, flags and exit 



directory buffer 

Byte to active buffer of LINDEX 

channel 

count off 28 bytes 



error processing, list directory 



page 



.37 



line addr object source code 



01680 
01681 
01682 
01683 
01684 
01685 
01686 
01687 
01688 
01689 
01690 



dbl9 
dbla 
dbla 
dbla 
dbla 
dbld 
dblf 
db20 
db20 
db22 
db24 



60 rts 

»=> Get character for directory loading <= 



20 b8 ed getdir Jsr getbyt 
fO 01 beq getd3 

60 rts 

85 18 getd3 sta data 
a4 15 Idy lindx 

b9 bd 00 Ida Istchr.y 



01691 db27 fO 08 



01692 
01693 

01694 

01695 

01696 

01697 

01698 

01699 

01700 

01701 

01702 

01703 

01704 

01705 

01706 

01707 

01708 

01709 

01710 

01711 

01712 

01713 

01714 

01715 

01716 

01717 

01718 

01719 

01720 

01721 

01722 

01723 

01723 

01724 



db29 
db2b 

db2e 

db30 

db31 

db31 

db34 

db34 

db34 

db34 

db34 

db36 

db39 

db3b 

db3d 

db3f 

db41 

db42 

db43 

db45 

db47 

db48 

db49 

db4a 

db4b 

db4c 

db4e 

db50 

db52 

db54 

db57 

dbSa 

db5b 

dbSb 



beq gdl 

a9 80 Ida #eoiout 

99 98 00 sta chnrdy.y 

a5 18 Ida data 

60 rts 

4c 9f da gdl jmp dirl 



Read one byte from the active buffer 
end-of-file if Z flag is set 

temporary data byte 

logical Index, channel number 

channel last character pointer, lo 

byte 

if we have exhausted the current 

buffer 

musthave reached EOF 

write, read, eoi flags, channel 

status 

temporary data byte 



create pseudo program listing 



=> Get number of blocks free in DRVNUM <= 



a6 12 

bd e8 d2 

85 05 

aO 04 

a9 OO 

85 04 

aa 

18 

71 04 

90 01 

e8 

c8 

c8 

c8 

c8 

cO 48 

fO f8 

cO 90 

dO ee 

8d 77 43 

8e 78 43 

60 



numfre Idx 
Ida 
sta 
Idy 
Ida 
sta 
tax 

nufflfl clc 
adc 
bcc 
inx 

numf2 iny 
iny 
iny 
iny 
cpy 
beq 
cpy 
bne 
sta 
stx 
rts 



drvnum 

ipbm,x 

tl 

#$04 

#0 

temp 



(temp),y 
numf2 



#$48 

numf2 

#$90 

numfl 

nbtemp 

nbtemp+l 



current drive 
BAM address hi 



lo pointer 
hi pointer 

temporary work area 



don't count the directory 



temporary number of blocks 



.lib par sex 



parse and execute command string 



page 



.38 



line 


addr 


object 




source 


code 




01726 


dbSb 


=> Parse 


& execute string in 


command buffer <= 


01727 


db5b 












01728 


db5b 


20 d2 


d9 


parsxq 


jsr okerr 


Transfer OK message to error buffer 


01729 


dbSe 


a5 17 






Ida orgsa 


original secondary address 


01730 


db60 


10 09 






bpl psOS 




01731 


db62 


29 Of 






and #$0£ 




01732 


db64 


c9 Of 






cmp #$0f 


is it the command channel? 


01733 


db66 


fO 03 






beq ps05 


(if it's the command channel) 


01734 


db68 


4c 79 


f2 




jmp open 


Open IEEE channel 


01735 


db6b 












01736 


db6b 


20 b6 dc 


ps05 


jsr cmdset 


Initialize crad tables & pointers 


01737 


db6e 


bl 45 






Ida (cb),y 


cmd buffer pointer lo 


01738 


db70 


8d 7b 43 




sta char 


character under parser 


01739 


db73 


a2 Oa 






Idx #ncmds-l 




01740 


db75 


bd al 


d2 


pslO 


Ida cradtbl.x 


search command table 


01741 


db78 


cd 7b 


43 




cmp char 


for character under parser 


01742 


db7b 


fO 08 






beq ps20 


o.k. — found 


01743 


db7d 


ca 






dex 


try 


01744 


db7e 


10 f5 






bpl pslO 


again 


01745 


dbSO 


a9 31 






Ida #badcmd 


no such command 


01746 


db82 


4c c9 


db 




jmp cmderr 


Command level error handling 


01747 


db85 












01748 


db85 


8e 7a 


43 


ps20 


stx cmdnum 


command number 


01749 


db88 


eO 08 






cpx #pcmd 


is it a command that needs parsing? 


01750 


db8a 


90 03 






bcc ps30 


if parsing is required. 


01751 


db8c 


20 ef 


db 




jsr tagcmd 


Tag command string, set up cmd & 
fllestream pointers 


01752 


db8f 


ae 7a 


43 


ps30 


Idx cmdnum 


move address of appropriate RCM 
routine 


01753 


db92 


bd ac 


d2 




Ida cjumpl.x 


from tables to 


01754 


db95 


85 04 






sta temp 


temporary storage 


01755 


db97 


bd b7 


d2 




Ida cjumph.x 


(lo/hl) 


01756 


db9a 


85 05 






sta tl 


then jump to routine 


01757 


db9c 


6c 04 00 




jmp (temp) 


via vector now in (temp) 


01758 


db9f 












01759 


db9f 












01760 


db9f 


==> Terminate command successfully <"= 


01761 


db9f 












01762 


db9f 


ad 73 


43 


endcmd Ida ervord 


error word for recovery. If not 0, 














error, so 


01763 


dba2 


dO 25 






bne cmderr 


report it! 


01764 


dba4 


aO 00 






Idy #0 


If command completed with no errors 


01765 


dba6 


98 






tya 


scratch entry: zero the 


01766 


dba7 


84 13 






sty track 


current track number 


01767 


dba9 


84 14 




scrend sty sector 


current sector number and 


01768 


dbab 


84 45 






sty cb 


cmd buffer pointer lo to zero 


01769 


dbad 


20 dd 


d9 




jsr errmsg 


then clear error status 


01770 


dbbO 


20 4b da 




jsr erroff 




01771 


dbb3 


a5 12 






Ida drvnum 


move current drive number to 


01772 


dbbS 


8d 94 43 




sta Istdrv 


last drive without error 


01773 


dbb8 


20 be 


db 




jsr clrcb 


Clear command buffer 


01774 


dbbb 


4c d3 


fO 




jmp freich 


Free both internal channels 


01775 


dbbe 













parse and execute command string 



page 



.39 



line addr object source code 



01776 

01777 

01778 

01779 

01780 

0178T 

01782 

01783 

01784 

01785 

01786 

01787 

0T788 

01789 

01790 

01791 

01792 

01793 

01794 

01795 

01796 

01797 

01 798 

01799 

01800 

01801 



dbbe 

dbbe 

dbbe 

dbcO 

dbc2 

dbc5 

dbc6 

dbc8 

dbc9 

dbc9 

dbc9 

dbc9 

dbc9 

dbcb 

dbcd 

dbcf 

dbd2 

dbd2 

dbd2 

dbd2 

dbd2 

dbd4 

dbd7 

dbd9 

dbdc 

dbde 



01802 dbdf 

01803 dbeO 

01804 dbe3 



01805 
01806 
01807 
01808 
01809 
01810 
01811 
01812 
01813 
01814 
01815 
01816 
01817 
01818 
01819 
01820 
01821 
01822 
01823 
01824 
01825 
01826 



dbe6 
dbe6 
dbe6 
dbe6 
dbe6 
dbe8 
dbea 
dbec 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 



===> Clear command buffer <== 



aO 39 
a9 00 
99 00 43 
88 

10 fa 
60 



clrcb 
clrb2 



Idy #cmdlen-l 

Ida #0 

sta cmdbuf,7 

dey 

bpl clrb2 

rts 



erase old commands in 
command buffer 



=> Command level error handling <= 



aO 00 cmderr Idy #0 

84 13 sty track 

84 14 sty sector 

4c 5c d9 jmp cmder2 



===> Simple parser <= 



current track number 
current sector number 



a2 00 
8e 80 43 
a9 3a 
20 69 dc 
fO 05 
88 

88 

8c 80 43 

4c 64 dd 



simprs Idx #0 

stx filtbl 
Ida #':• 
jsr parse 
beq splO 
dey 



splO 



dey 

sty filtbl 

Jmp setany 



scan for colon. If found, Z=l 

.Y points to its position in the 
command 



Set drive number from any 
configuration 



===> Find colon in command string <== 

aO 00 prscln Idy #0 

a2 00 Idx #0 

a9 3a Ida #':' 

^•^ 69 dc jmp parse Store desired character in CHAR 

===> Tag command string, set up cmd & filestream pointers <== 



Command structure (bit mapped) 

The commands RENAME, SCRATCH, NEW and LOAD are analyzed by this 
routine to determine the command structure. As the command is 
parsed, bits in IMAGE are set or cleared to indicate the presence 
or absence of various parts of the command. After analysis the 
structure image is checked against the correct structure for that 
command in STRUCT 



parse and execute command string 



page 



.40 



line addr object 



source code 



01827 
01828 
01829 
01830 
01831 
01832 
01833 
01834 
01835 
01836 
01837 
01838 
01839 
01840 
01841 
01842 
01843 
01844 
01845 
01846 
01847 
01848 
01849 

01850 
01851 
01852 
01853 
01854 



dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbef 
dbf2 
dbf4 
dbf6 
dbf9 
dbf9 
dbfa 
dbfb 

dbfe 
dbff 
dcOl 
dc03 
dc06 



PI 
Gl 
Dl 
Nl 
P2 
G2 
D2 
N2 



Wild cards present (Y^l) 
More than one file implied (Y^l) 
Drivel specified (not default) 
Filenamel given 
Wild cards present (Y=l) 
More than one file implied (Y=l) 
Drivel specified (not default) 
Filenaoe2 given 

Bits 7-4 refer to filel 1 
Bits 3-0 refer to filel 2 



20 e6 db 
dO 05 
a9 34 
4c c9 db 

88 
88 
8c 80 43 

8a 

dO f3 
a9 3d 
20 69 dc 
8a 



01855 dc07 fO 02 



01856 

01857 

01858 
01859 
01860 

01861 
01862 
01863 
01864 
01865 
01866 
01867 
01868 
01869 
01870 
01871 
01872 



dc09 

dcOb 

dcOd 
dclO 
dell 

dcl4 
del 7 
del a 
dele 
dele 
dc2l 
dc24 
dc26 
dc29 
dc2a 
dc2c 
dc2f 



a9 40 

09 21 

8d 91 43 

e8 

8e 7d 43 

8e 7e 43 
ad 90 43 
fO Od 
a9 80 
Od 91 43 
8d 91 43 
a9 00 
8d 90 43 
98 

fO 29 
9d 80 43 
ad 7d 43 



tagemd Jsr 
bne 

tc25 Ida 
jmp 



tc30 



tc50 



dey 
dey 
sty 



txa 
bne 
tc35 Ida 
Jar 
txa 

beq 

Ida 

tc40 ora 



prseln 
te30 
Inofile 
cmderr 



filtbl 

tc25 
!•=• 
parse 

tc40 

I%01000000 
IZOOl 00001 



sta Image 

inx 

stx flcnt 

stx f2cnt 
Ida patflg 
beq tc50 
Ida I%1 0000000 
ora image 
sta image 
Ida 10 
sta patflg 
tya 

beq tc75 
sta filtbl, X 
Ida flcnt 



Find colon In command string 

this is a bad command — no files! 
Command level error handling 



if ":" found, filestream I starts at 
previous character 
if .1 > 0, bad syntax 



Store desired character in CHAR 

.X=0 indicates no ♦ or ? found, else 

set bit 6 

of IMAGE to Indicate that the 

command applies 

to more than one file. In all cases 

set bit 5 

to Indicate that a second filename 

is given (is 

fixed later) 

use to set 

size of fllenamel and 2. Fllename2 

will 

default to same length as fnl 

has PARSE found wild cards? If so, 

set bit 7 

file stream image 

file stream image 

prepare for parsing of 

rest of command 

any more commands to parse? if Y=0, 

no more, so check structure, else 

value of Y in filtbl 

set pointer to start of filenaffle2 

from 



parse and execute command string 



page 



.41 



line addr object source code 



01873 
01874 
01875 
01876 
0T877 
01878 
01879 
01880 
01881 
01882 

01883 
01884 



dc32 
dc35 
dc37 
dc3a 
dc3b 
dc3e 
dc3f 
dc42 
dc44 
dc46 

dc49 
dc4b 



8d 7f 43 

a9 8d 

20 69 dc 

e8 

8e 7e 43 

ca 

ad 90 43 

fO 02 

a9 08 

ec 7d 43 

fO 02 
09 04 



tc60 



sta f2ptr 

Ida #$8d 

jsr parse 

inx 

stx f2cnt 

dex 

Ida patflg 

beq tc60 

Ida #%1000 

cpx flcnt 

beq tc70 
ora #%0100 



01885 dc4d 09 03 



tc70 ora #20011 



01886 

01887 

01888 

01889 

01890 

01891 

01892 

01893 

01894 

01895 

01896 

01897 

01898 

01899 

01900 

0190; 

01902 

01 903 

01904 

01905 

01906 

01907 

01908 

01909 

or 910 

01911 

01912 

01913 

01914 

01915 

01916 

01917 

01918 

01919 

01920 

01921 

01922 



dc4f 

dc52 

dc55 

dc58 

dc5b 

dc5e 

dc60 

dc61 

dc6T 

dc64 

dc66 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc69 

dc6c 

dc6f 

dc7l 

dc73 

dc74 

dc77 

dc79 



4d 91 43 
8d 91 43 
ad 91 43 
ae 7a 43 
3d bb d2 
dO 01 
60 

8d 73 43 
a9 30 
4c c9 db 



tc75 



tc80 



eor image 
sta image 
Ida image 
Idx cmdnum 
and struct, X 
bne tc80 
rts 

sta erword 
Ida #badsyn 
Jfflp cmderr 



current value of filenamel 

find shifted CR 

Store desired character in CHAR 

file stream 2 count 

restore for test 

last pattern 

if any wildcards found, 

set bit 3 

check if second filename. If only 

one 

character long, branch, else 

set bit 2 (command Implies more than 

one filename) 

bit I (more drives) and bit 

(more filenames). Then 

clear bit and 

restore 

check image against 

entry 

in command template 

if o.k. 

error word for recovery 

Command level error handling 



Parse string: 

On entry, ,A contains character to be found in the string. 

.Y points to that character where scan must begin 

.X points into the filetable. 
The routine also scans the string for special characters (* 7 ,). 
When a wild card is found, the pattern flag is incremented. When 
a comma is found, or the end of the command is reached, the 
routine ends. If no wild cards are found, the pattern flag is set 
to $80, otherwise it remains unchanged. 

On exit, .Y=0 and the Z-flag =0 if the desired character has not 
been found. If it has been found, .Y= the position of the character 
and the Z flag is set. 



=> Store desired character in CHAR <- 



8d 7b 43 
cc 79 43 
bO 2f 
bl 45 
c8 

cd 7b 43 
fO 29 
c9 2a 



parse 
prlO 



sta char 
cpy cmdsiz 
bcs pr30 
Ida (cb),y 
iny 

cmp char 
beq pr35 
cmp #•*• 



character under parser 
command string size 

cmd buffer pointer lo 

character under parser 

check for wild cards 



parse and execute command string 



page 



.42 



line addr object 



source code 



01923 dc7b 

01924 dc7d 

01925 dc7f 

01926 dc8l 

01927 dc84 

01928 dc86 



01929 
01930 
01931 
01932 
01933 
01934 
01935 
01936 
01937 
01938 
01939 
01940 
01941 
01942 
01943 
01944 
01945 
01946 
01947 
01948 
01949 
01950 
01951 
01952 
01953 
01954 
01955 

01956 
01957 
01958 
01959 
01960 
01961 
01962 
01963 
01964 
01965 
01966 



dc88 
dc89 
dc8c 
dc8£ 
dc91 
dc93 
dc95 
dc98 
dc9b 
dc9c 
dc9e 
dcaO 
dca2 
dca5 
dca8 
dcab 
dead 
deaf 
dcbl 
dcb4 
dcbS 
dcb6 
dcb6 
dcb6 
dcb6 
dcb6 
dcb6 

dcb8 
dcba 
dcbb 
dcbd 
dccO 
dcc2 
dcc4 
dec 5 
dcc8 
dcca 
dccc 



fO 04 
c9 3f 
dO 03 
ee 90 43 

c9 2c 
dO e4 

98 

9d 81 43 
ad 90 43 
29 7f 
fO 08 
a9 80 
9d 86 43 
8d 90 43 
e8 

eO 04 
90 cc 
aO 00 
ad 79 43 
9d 81 43 
ad 90 43 
29 7f 
£0 05 
a9 80 
9d 86 43 
98 
60 



pr20 
pr25 



pr28 



pr30 
pr35 



pr40 



beq pr20 
cmp #'?' 
bne pr25 
inc patflg 

cmp #',• 
bne prlO 

tya 

sta filtbl+l,x 
Ida patflg 
and #$7f 
beq pr28 
Ida #$80 
sta filtrk,x 
sta patflg 
Inx 

cpx #mxfila-l 
bcc prlO 
Idy #0 
Ida cmdslz 
sta filtbl+l,x 
Ida patflg 
and #$7f 
beq pr40 
Ida #$80 
sta flltrk,x 
tya 
rts 



pattern present flag, count # of 

wild cards 

do we have a comma? 

if not, get next command string 

character 

find out where filename ends 
save pattern for each file 
means no wild cards 

wild cards present, so indicate this 

first link/track 

clear the count 

number of files 

4 files allowed in string. If less, 

continue scanning 

desired character not found (Z=l) 

copy command string size 



pattern present flag 
no wild cards if 

wild cards present, 
first link/track 
Z is set 



Indicate this 



==> Initialize cmd tables & pointers <==» 

Find length of command string and zero variables and pointers 



a4 45 

fO 14 

88 

fO 10 

b9 00 43 

c9 Od 

fO Oa 

88 

b9 00 43 

c9 Od 

fO 02 

c8 



cmdset Idy cb 



beq cs08 

dey 

beq cs07 

Ida cmdbuf,y 

cmp #cr 

beq cs08 

dey 

Ida cmdbuf,y 

cmp #cr 

beq cs08 

iny 



01967 deed e8 



cs07 iny 



01968 
0V969 
01970 



dcce 
dcdl 
dcd3 



8c 79 43 
cO 3b 
aO ff 



cs08 



sty cmdsiz 
cpy #cmdlen-l-l 
Idy #$ff 



cmd buffer pointer lo (command size 
sent from computer) 



character from command buffer 
carriage return? 



next character 



if not a carriage return, increment 

pointer 

increment command buffer pointer, 

then store 

length. Compare with 

maximum allowable 



parse and execute command string 



page 



.43 



line addr object source code 



01971 dcd5 90 08 



01972 

01973 

01974 

01975 

01976 

01977 

01978 

01979 

01980 

01981 

01982 

01983 

01984 

01985 

01986 

01987 

01988 

01989 

01990 

01991 

01992 

01993 

01994 

01995 

01996 

01997 

01998 

01999 

02000 

02001 

02002 

02003 

02004 



dcd7 

dcda 

dcdc 

dcdf 

dcdf 

dcdf 

dcdf 

dcdf 

dcel 

dce2 

dce4 

dce7 

dce9 

dcec 

dcee 

deft 

dcf4 

dcf7 

dcfa 

dcfd 

dcff 

dd02 

dd04 

dd06 

dd09 

ddOc 

ddOd 

ddOf 

ddlO 

ddlO 

ddIO 

ddlO 

ddIO 



8c 7a 43 
a9 32 
4c c9 db 



bcc cmdrst 

sty cmdnum 
Ida #longln 
jmp cmderr 



Zero all important variables and 

pointers 

command is oversize 

Command level error handling 



=> Zero all important variables and pointers <« 



aO 00 
98 

85 45 
8d 4b 43 
85 c5 
8d 9c 43 
85 81 
8d 7f 43 
8d 7d 43 
8d 7e 43 
8d 90 43 
8d 73 43 
a2 05 
9d 7f 43 
95 85 
95 8a 
9d 85 43 
9d 8a 43 
ca 

dO fO 
60 



cmdrst Idy 
tya 
sta 
sta 
sta 
sta 
sta 
sta 
sta 
sta 
sta 
sta 
Idx 

cslO sta 
sta 
sta 
sta 
sta 
dex 
bne 
rts 



#0 

cb 

rec 

type 

typflg 

flptr 

f2ptr 

flcnt 

f2cnt 

patflg 

erword 

#mxfils 

filtbl-l,x 

filent-l,x 

fildat-l,x 

filtrk-l,x 

fllsec-1 ,x 

cslO 



cmd buffer pointer lo 
record size 
current file type 
match by type of file 
file stream 1 pointer 
file stream 2 pointer 
file stream 1 count 
file stream 2 count 
pattern present flag 
error word for recovery 



=> Set first drive & table pointers <== 
ad 7e 43 onedrv Ida f2cnt 
02005 ddl3 8d 7d 43 sta flcnt 



02006 
02007 
02008 
02009 
02010 
02011 
02012 
02013 
02014 
02015 
02016 
02017 

02018 
02019 



ddl6 
ddl8 
ddlb 
ddle 
ddle 
ddle 
ddle 
ddle 
dd21 
dd23 
dd25 
dd28 

dd2b 
dd2d 



a9 01 
8d 7e 43 
8d 7f 43 



Ida #1 
sta f2cnt 
sta f2ptr 



change pointer to end of first 

filename 

to point to the end of second 

filename, 

then clear these variables: 



=> Set up all drives from F2CNT <- 



ac 94 43 alldrs Idy Istdrv 
a2 00 idx #0 

86 81 adlO stx flptr 
bd 80 43 Ida filtbl.x 
20 3a dd jsr setdrv 

a6 81 Idx flptr 

9d 80 43 sta filtbl.x 



set up drive numbers 
into file entry table 
on sector pointer byte 

Set drive number from text or 
default to 
file stream I pointer 
increment past ":" 



parse and execute command string 



page 



.44 



line 


addr 


ob: 


ject 


source 


code 




02020 


dd30 


98 






tya 


bits represent drives 


02021 


dd31 


95 8b 




sta flldat.x 


bit 7: default 


02022 


dd33 


eS 






inx 


bit 0: drive number 


02023 


dd34 


ec 


7e 43 




cpx f2cnt 


see if any more files specified 


02024 


dd37 


90 


ea 




bcc adlO 




02025 


dd39 


60 






rts 


no more 


02026 


dd3a 












02027 


dd3a 












02028 


dd3a 




.> Set 


drive number from text or 


default to <== 


02029 


dd3a 












02030 


dd3a 


aa 




setdrv 


tax 


.A " index into command buffer 


02031 


dd3b 


a9 


3a 




Ida #•:' 


hunt for colon 


02032 


dd3d 


dd 


01 43 




cmp cmdbuf+l,x 


in command string 


02033 


dd40 


fO Oc 




beq setnme 


Set drive number from command 














string. Syntax X#: FILENAME 


02034 


dd42 


dd 


00 43 




cmp cmdbuf,x 


command buffer 


02035 


dd45 


dO 


16 




bne setfle 


Set drlve# from command string. 
Syntax X#,FILE or xx=FILE 


02036 


dd47 


eS 






inx 




02037 


dd48 


98 




sd20 


tya 


set up default drive 


02038 


dd49 


29 


01 


sd22 


and #1 


make sure drive number converted to 
$0 or $1 


02039 


dd4b 


a8 




sd24 


tay 


restore drive number 


02040 


dd4c 


8a 






txa 


and index & xxxxflle 


02041 


dd4d 


60 






rts 




02042 


dd4e 












02043 


dd4e 












02044 


dd4e 




■> Set 


drive number from coimiiand 


I string. Syntax X#: FILENAME <== 


02045 


dd4e 












02046 


dd4e 






sd40 






02047 


dd4e 


bd 


00 43 


setnme 


Ida cmdbuf)X 


command buffer 


02048 


ddSl 


e8 






inx 


XXX : file 


02049 


dd52 


e8 






inx 


points to first filename 
character 


02050 


dd53 


c9 


30 




cmp #$30 


xx0:file 


02051 


dd55 


fO 


f2 




beq sd22 




02052 


dd57 


c9 


31 




cmp #$31 


xxl:file 


02053 


dd59 


fO 


ee 




beq sd22 




02054 


dd5b 


dO 


eb 




bne sd20 


cmd: file or xxifile 


02055 


ddSd 






sd50 


.* 




02056 


dd5d 












02057 


dd5d 




»> Set drive* from command string. Syntax X#,FILE or xx=FILE <=== 


02058 


dd5d 












02059 


dd5d 


98 




setfle 


1 tya 


for XXX, file or xx=file 


02060 


dd5e 


09 80 




ora #%1 0000000 




02061 


dd60 


29 81 




and #210000001 


drive is default, mask off odd bits 


02062 


dd62 


dO 


e7 




bne 8d24 


terminate testing 


02063 


dd64 












02064 


dd64 




»> Set 


drive number from any configuration <== 


02065 


dd64 












02066 


dd64 


a9 00 


setany 


Ida #0 




02067 


dd66 


8d 


91 43 




sta image 


file stream Image 


02068 


dd69 


ac 


80 43 




Idy filtbl 





parse and execute command string 



page 



.45 



line addr object source code 



02069 dd6c 

02070 dd6e 

02071 dd7l 

02072 dd73 



02073 

02074 

02075 

02076 

02077 

02078 

02079 

02080 

02081 

02082 

02083 

02084 

02085 

02086 

02087 

02088 

02089 

02090 

02091 

02092 

02093 

02094 

02095 

02096 

02097 

02098 

02099 

02100 
02101 
02102 
02103 
02104 
02105 
02106 
02107 
02108 
02109 
02110 
02111 
02112 
02U3 



dd74 

dd77 

dd79 

dd7c 

dd7d 

dd7f 

dd82 

dd85 

dd87 

dd89 

ddSc 

dd8c 

ddSc 

ddSc 

ddSc 

ddSe 

dd90 

dd92 

dd94 

dd95 

dd95 

dd95 

dd95 

dd95 

dd97 

dd9a 

dd9d 

dd9f 
dda2 
ddaS 
dda8 
dda9 
ddab 
ddad 
ddbO 
ddb2 
ddb3 
ddb5 
ddb6 
ddb7 
ddba 



b1 45 
20 bb dd 
10 12 
c8 

cc 79 43 
bO 06 
ac 79 43 
88 

dO ed 
ce 91 43 
ad 94 43 
29 01 
85 12 
4c 35 da 



sa05 



salO 



sa20 



Ida (cb),y 
jsr tstOvl 
bpl sa20 
iny 

cpy cmdsiz 
bcs salO 
Idy cmdsiz 
dey 

bne sa05 
dec image 
Ida Istdrv 
and #1 
sta drvnum 
Jmp setlds 



===> Toggle drive number <== 

a5 12 togdrv Ida drvnum 

49 01 eor #1 

29 01 and #1 

85 12 sta drvnum 

60 rts 



cmd buffer pointer lo 

Test for or 1 

(if drive number given) 

point to end of command less 1 so we 

can 

pick up things like VO 

command string size 



(becomes $ff) to flag default: 
last drive without error 

current drive number 

Turn on LED for current drive 



current drive number 



current drive number 



===> Set pointers to one file stream and check type <= 



aO 00 
ad 7d 43 
cd 7e 43 
fO 16 

ce 7e 43 

ac 7e 43 

b9 80 43 

a8 

bl 45 

aO 04 

d9 d4 d2 

fO 03 

88 

dO f8 

98 

Oa 

8d 9c 43 

60 



f si set Idy #0 

Ida flcnt 
cmp f2cnt 
beq fsl5 

dec f2cnt 

Idy f2cnt 

Ida filtbl.y 

tay 

Ida (cb),y 

Idy #ntypes-l 
fslO cmp typist, y 

beq fsl5 

dey 

bne fslO 
fsl5 tya 

asl a 

sta typflg 

rts 



pointer to end of filenamel 

equals same for filename27 

if equal, there is no second file, 

else 

file stream 2 count 
pointer to flletype 

cmd buffer pointer lo 

DEL, SEQ, PRG, USR, REL 
if no match, assume DEL 



transfer file type to .A 
and store 



tests, auto initialization, lookup 



page 



.46 



line addr object 



source code 



02115 ddbb =>=■> Test for or 1 <= 



02116 
02117 
02118 
02119 
02120 
02121 
02122 
02123 
02123 
02124 

02126 

02127 

02128 

02129 

02130 

02131 

02132 

02133 

02134 

02135 

02136 

02137 

02138 

02139 

02140 

02141 

02142 

02143 

02144 

02145 

02146 

02147 

02148 

02149 

02150 

02151 

02152 

02153 

02154 

02155 

02156 

02157 

02158 

02159 

02160 

02161 

02162 

02163 

02164 

02165 

02166 

02167 



ddbb 
ddbb 
ddbd 
ddbf 
ddcl 
ddc3 
ddc5 
ddc7 
ddc8 
ddc8 

ddc8 
ddc8 
ddc8 
ddc8 
ddc8 
ddc8 
ddc8 
ddca 
ddcd 
dddO 
ddd2 
ddd4 
ddd6 
dddS 
dddb 
dddb 
ddde 
ddeO 
dde2 
dde5 
dde7 
dde9 
ddeb 
ddee 
ddee 
ddef 
ddfO 
ddfl 
ddf2 
ddf3 
ddf5 
dd£6 
ddf7 
ddfa 
ddfd 
ddff 
de02 
de05 
de07 
de09 
deOc 
deOd 



c9 30 
fO 06 
c9 31 
fO 02 
09 80 
29 81 
60 



tstOvl 



tOvl 



cmp #'0' 
beq tOvl 
cmp #'1* 
beq tOvl 
ora #%1 0000000 
and |%10000001 
rts 

.lib autolt 



set bit 7 if no match found 
convert to hex and preserve bit 7 



==> RSR test subroutines <== 

Checks if drive number is initialized. This routine works if 
CATALOG calls it before any header is transferred. It will end 
in error if any error but disk ID occurs 



a2 ff autolt Idx #$ff 

8e 9e 43 stx jobrtn 

20 e4 ec jsr initsu 

c9 03 cmp #$03 

fO 07 beq catid3 

c9 02 cmp #$02 

90 16 bcc catid4 
4c 25 d9 catid2 jmp error 

ac 92 43 catid3 Idy drvcnt 

fO f8 beq catid2 

a9 00 Ida #0 

8d 92 43 sta drvcnt 

a5 12 Ida drvnum 

49 01 eor #1 

85 1 2 sta drvnum 

4c c8 dd Jmp autolt 

8a catid4 txa 

Oa asl a 

Oa asl a 

Oa asl a 

a8 tay 

a5 12 Ida drvnum 

Oa asl a 

aa tax 

b9 21 10 Ida hdrs,y 

dd 40 43 cmp dskid,x 

dO Oe bne catidi 

b9 22 10 Ida hdrs+l,y 

dd 41 43 cmp dskid+l,x 

dO 06 bne catidi 

a5 al Ida Jobnum 

20 97 ec jar seth 

60 rts 



flag for error RTN 
Job return flag 
.A = DRVNUMO-error 
check missing disk 

check for o.k. 

must be error, so report 

number of drive searches 

only one good drive? 
number of drive searches 
current drive number 
flip to check the other 
current drive number 
RSR test subroutines 

preserve .X 
multiply by 8 



current drive number 



check disk ID 
against old ID 

ID2 



retrieve job 

so we can restore all 

under same ID 



tests, auto initialization, lookup 



page ...47 



line addr object source code 



02168 

02169 

02170 

02171 

02172 

02173 

02174 

02175 

02176 

02177 

02178 

02179 

02180 

02181 

02182 

02183 

02184 

02185 

02186 

02187 

02188 

02189 

02190 

02191 

02192 

02193 

02194 

02195 

02196 

02197 

02198 

02199 

02200 

02201 

02202 

02203 

02204 

02205 

02206 

02207 

02208 

02209 

02210 

02211 

02212 

02213 

02214 

02215 

02216 

02217 

02218 

02219 

02220 



deOd 

delO 

delO 

delO 

delO 

de12 

de14 

del 7 

del 8 

delb 

dele 

dele 

delf 

de21 

de23 

de24 

de26 

de28 

de2a 

de2c 

de2e 

de2f 

de3r 

de33 

de35 

de36 

de37 

de3a 

de3b 

de3d 

de40 

de4l 

de42 

de44 

de46 

de48 

de4a 

de4d 

de4f 

de52 

de55 

de57 

de59 

de5a 

de5c 

deSe 

de61 

de62 

de64 

de67 

de67 

de67 

de68 



4c ff ec catidl jmp initdr 
=> Determine optimal search for 



a9 00 

85 04 

8d 93 43 

48 

ae 7e 43 

68 

05 04 
48 

a9 01 
85 04 
ca 

30 Of 
b5 8b 
10 04 

06 04 
06 04 
4a 

90 ea 

06 04 

dO e6 

68 

aa 

bd 6a de 

48 

29 03 

8d 92 43 

68 

Oa 

10 23 

a5 8b 

29 01 

85 12 
ad f3 
dO 15 
20 c8 dd 
ad 92 43 
fO Od 
a5 12 
48 

49 01 
85 12 
20 c8 dd 
68 

85 12 
4c 35 da 



10 



oslO 



osl5 



os30 



optsch Ida 

sta 

sta 

pha 

Idx 

pla 

ora 

pha 

Ida 

sta 

dex 

bmi 

Ida 

bpl 

asl 

asl 

Isr 

bcc 

asl 

bne 

pla 

tax 

Ida 

pha 

and 

sta 

pla 

asl 

bpl 

Ida 

and 

sta 

Ida 

bne 

Jsr 

Ida 

beq 

Ida 

pha 

eor 

sta 

Jsr 

pla 

sta 

oxOOOO Jmp 



os35 



#0 

temp 

drvflg 

f2cnt 

temp 

#1 
temp 

os30 

fildat.x 

osl5 

temp 

temp 

a 

oslO 

temp 

oslO 



schtbl-l,x 

#$03 
drvcnt 

a 

os40 

fildat 

#1 

drvnum 

autofg 

oxOOOO 

autoit 

drvcnt 

oxOOOO 

drvnum 

#1 

drvnum 

autoit 

drvnum 
setlds 



different, so initialize 
LOOKUP and FINFIL <== 



init drive mask 

$00 

file stream 2 count 



($ff if no files left) 
drive number, pattern 
if default drive 



if drive number was 1 , carry is set 

since it was 
branch 



index into 
search table 



number of drive searches 



(if bit 7 not set) 
drive number, pattern 

current drive number 



RSR test subroutines 
number of drive searches 

current drive number 

save it 

flip it 

current drive number 

RSR test subroutines 

restore drive number 

current drive number 

Turn on LED for current drive 



2a 

4c 46 de 



os40 



rol a 
Jmp os35 



tests, auto Initialization, lookup 



page 



.48 



line 


addr 


object 


source 


! code 






02221 


de6b 














02222 


de6b 


==> Search table 


<== 






02223 


de6b 














02224 


de6b 


00 80 41 


schtbl 


• byt 


:e $00. 


$80, 


$41 


02225 


de6e 


01 01 01 




•byte 1,1,1 


.1 




02226 


de71 


01 












02227 


de72 


81 81 81 




.byt 


;e $81. 


$81. 


$81. $81 


02228 


de75 


81 












02229 


de76 


42 42 42 




.byt 


:e $42, 


$42. 


$42. $42 


02230 


de79 


42 












02231 


de7a 














02232 


de7a 














02233 


de7a 


=> Look 


up files in cmd string 


in dir. & fill tables <-= 


02234 


de7a 














02235 


de7a 


20 10 de 


lookup jsr 


optsch 




Determine optimal search for LOOKUP 
















and FINFIL 


02236 


de7d 


a9 00 


lk05 


Ida #0 




indicate not looking for DEL or 
















unused entry 


02237 


de7f 


8d 98 43 




sta 


delind 




index of first available entry 


02238 


de82 


20 da df 




Jsr 


srchst 




Initiate search of directory 


02239 


de85 


dO la 




bne 


lk25 




(If valid name found) 


02240 


de87 


ce 92 43 


IklO 


dec 


drvcnt 




number of drive searches 


02241 


deSa 


10 01 




bpl 


lkl5 






02242 


deSc 


60 




rts 








02243 


deSd 














02244 


de8d 


a9 01 


lkl5 


Ida #1 






02245 


de8f 


8d 93 43 




sta 


drvflg 




drive search flag 


02246 


de92 


20 8c dd 




jsr 


togdrv 




Toggle drive number 


02247 


de95 


20 35 da 




jsr 


setlds 




Turn on LED for current drive 


02248 


de98 


fO e3 




beq 


lk05 




branch always 


02249 


de9a 


dO el 




bne 


lk05 






02250 


de9c 


20 43 eO 


lk20 


Jar 


search 




Continue search of entries 


02251 


de9f 


fO 10 




beq 


lk30 




(abandon if no valid name found) 


02252 


deal 


20 04 df 


lk25 


Jsr 


compar 




Compare files in cmd list with valit 
directory entries 


02253 


dea4 


ad 95 43 




Ida 


found 




found flag in directory searches 


02254 


dea7 


fO 01 




beq 


lk26 




if not found 


02255 


dea9 


60 




rts 








02256 


deaa 














02257 


deaa 


ad 45 43 


lk26 


Ida 


entfnd 




directory entry found flag 


02258 


dead 


30 ed 




bmi 


lk20 




does it match? $ff=not 


02259 


deaf 


10 fO 




bpl 


lk25 




(if found, try again) 


02260 


debl 


ad 95 43 


lk30 


Ida 


found 




found flag in directory searches 


02261 


deb4 


fO dl 




beq 


IklO 




(all files not yet found, continue) 


02262 


deb6 


60 




rts 








02263 


deb7 














02264 


deb7 














02265 


deb7 


==> Find 


next name in file stream and table entry <=== 


02266 


deb7 














02267 


deb7 


20 31 eO 


ffre 


Jsr 


srre 




set up and read in next entry block 


02268 


deba 


fO la 




beq 


fflO 




(none found) 


02269 


debc 


dO 28 




bne 


ff25 




found 


02270 


debe 


a9 01 


ffl5 


Ida #1 




switch to the other drive: 



tests, auto initialization, lookup 



page ...49 



line addr object source code 



02271 
02272 
02273 
02274 
02275 
02276 
02277 

02278 
02279 
02280 
02281 
02282 
02283 
02284 
02285 
02286 
02287 
02288 
02289 
02290 
02291 
02292 
02293 

02294 
02295 
02296 
02297 
02298 
02299 
02300 
02301 
02302 
02303 
02304 
02305 
02306 
02307 
02308 
02309 
02310 
02311 
02312 
02313 
02314 
02315 
02316 
02317 
02318 

02319 
02320 



decO 
dec3 
dec6 
dec9 
dec9 
dec9 
dec9 

decb 
dece 
dedl 
ded3 
ded6 
ded9 
dedb 
dede 
deeO 
deel 
deel 
deel 
deel 
deel 
dee4 
dee6 

dee9 
deec 
deee 
defl 
def3 
de£5 
def8 
defa 
defc 
defe 
dfOl 
d£03 
df04 
df04 
df04 
df04 
df04 
df06 
df09 
dfOa 
dfOd 
dflO 
dfl2 
dfl3 
dfl3 

dfl6 
dfl8 



8d 93 43 
20 8c dd 
20 35 da 



sta drvflg 
jsr togdrv 
jsr setlds 



drive search flag 

Toggle drive number 

Turn on LED for current drive 



==> Find starting entry in directory <■ 



a9 00 

8d 98 43 
20 da df 
dO 13 
8d 95 43 
ad 95 43 
dO 28 
ce 92 43 
10 de 
60 



ffst Ida #0 



fflO 



sta delind 
jsr srchst 
bne ff25 
sta found 
Ida found 
bne ff40 
dec drvcnt 
bpl ffl5 
rts 



not looking for DEL or unused 
entries I 

index of first available entry 
Initiate search of directory 
if ZaO: valid name found 

if not 0, all files found, so 

nothing more on this drive, so 
try the other. If none left, 
exit 



===> Continue scan of directory <= 



20 43 eO 
fO fO 
20 04 df 



fndfil jsr search 

beq fflO 
ff25 jsr compar 



ae 45 43 

10 07 

ad 95 43 

fO ee 

dO Oe 

ad 9c 43 ff30 

fO 09 

b5 8b 

29 le 

cd 9c 43 

dO de 

60 ff40 



Idx entfnd 
bpl ff30 
Ida found 
beq fndfil 
bne ff40 
Ida typflg 
beq ff40 
Ida fildat.x 
and #$le 
cmp typflg 
bne fndfil 
rts 



retrieve next valid filename 

Compare files in cmd list with valid 
directory entries 
directory entry found flag 

found flag in directory searches 
continue scan of directory 

match by type of file 

drive number, pattern 

match by type of file 
Continue scan of directory 



=> Compare files in cmd list with valid directory entries <== 



a2 ff 

8e 45 43 

e8 

8e 90 43 

20 b9 df 

fO 06 

60 

20 c4 df 



compar Idx #$ff 

stx entfnd 

inx 

stx patflg 

Jsr cmpchk 

beq cplO 

rts 



dO fa 
a5 12 



cp02 
cp05 

cpIO 



jsr cclO 

bne cp02 
Ida drvnum 



directory entry found flag 

zero the 

pattern present flag 

Check table for unfound files 



point to next file. If no more 

needed, 

exit, else 

current drive number 



tests, auto Initialization, lookup 



page 



.50 



line 


addr 


object 


source code 




02321 


dfla 


55 8b 




eor fildat.x 


drive number, pattern 


02322 


dflc 


4a 




Isr a 




02323 


dfld 


90 Ob 




bcc cp20 


(if carry flag clear, drive number 

o.k.) 

see if default to be used ($40 not 


0232-4 


dflf 


29 40 




and #$40 












$80 because 


02325 


df2l 


fO fO 




beq cp05 


of LSR). If no can use default, set 
up next 


02326 


df23 


a9 02 




Ida #$02 


filename, else check the 


02327 


df25 


cd 92 43 




cmp drvcnt 


number of drive searches. If equal. 


02328 


df28 


fO e9 




beq cp05 


don't use default, else we have a 
match 


02329 


d£2a 


bd 80 43 


cp20 


Ida filtbl,x 


on drive numbers. Now find a name. 


02330 


df2d 


aa 




tax 




02331 


df2e 


20 a1 eO 




Jsr fndlfflt 


Find end of string in command buffei 


02332 


df31 


aO 03 




Idy #$03 


to make it point past type, T & S 


02333 


df33 


4c 49 df 




jmp cp33 




02334 


df36 










02335 


df36 


bd 00 43 


cp30 


Ida cmdbuf ,x 


command buffer (filename) 


02336 


d£39 


dl 27 




cmp (dirbuf),y 


directory buffer pointer (direct, 
entry) 


02337 


df3b 


fO Oa 




beq cp32 




02338 


df3d 


c9 3f 




cmp #'?• 


7 matches any character 


02339 


df3f 


dO d2 




bne cp05 




02340 


df4l 


bl 27 




Ida (dirbuf),y 


directory buffer pointer 


02341 


df43 


c9 aO 




cmp #$aO 


reached shifted space (end of entry 
name)? 


02342 


df45 


fO cc 




beq cp05 




02343 


df47 


e8 


cp32 


inx 


set up for next character 


02344 


df48 


c8 




iny 




02345 


df49 


ec 7c 43 


cp33 


cpx limit 


pointer limit in comparison 


02346 


df4c 


bO 09 




bcs cp34 


(if at end of string) 


02347 


df4e 


bd 00 43 




Ida cmdbuf ,x 


command buffer 


02348 


df51 


c9 2a 




cmp #•*• 




02349 


df53 


fO Oc 




beq cp40 




02350 


df55 


dO df 




bne cp30 


keep matching 


02351 


df57 


cO 13 


cp34 


cpy #$13 


end of name? 


02352 


df59 


bO 06 




bcs cp40 




02353 


df5b 


bl 27 




Ida (dirbuf),y 


directory buffer pointer 


02354 


df5d 


c9 aO 




cmp #$aO 




02355 


df5f 


dO b2 




bne cp05 


if not shifted space, try again 


02356 


df61 


ae 7f 43 


cp40 


Idx f2ptr 


names match, so store pointer into 

the 

directory entry found flag and fill 


02357 


df64 


8e 45 43 




stx entfnd 












tables : 


02358 


df67 


bd 86 43 




Ida filtrk,x 


first link/track 


02359 


d£6a 


29 80 




and #$80 




02360 


df6c 


8d 90 43 




sta patflg 


pattern present flag 


02361 


df6f 


9d 86 43 




sta filtrk.x 


first link/track 


02362 


df72 


ad 9a 43 




Ida Index 


current index in buffer 


02363 


df75 


29 eO 




and #$e0 




02364 


df77 


85 04 




sta temp 




02365 


df79 


a5 14 




Ida sector 


current sector number 



tests, auto initialization, lookup 
line addr object source code 



02366 df7b 05 04 

02367 df7d 95 86 

02368 df7f aO 00 

02369 df81 bl 27 

02370 df83 c8 

02371 df84 48 

02372 df85 29 40 



ora temp 

sta filent.x 

Idy #0 

Ida (dirbuf),y 

iny 

pha 

and #$40 



02373 

02374 

02375 

02376 

02377 

02378 

02379 

02380 

02381 

02382 

02383 

02384 

02385 

02386 

02387 

02388 

02389 

02390 

02391 

02392 

02393 

02394 

02395 

02396 

02397 

02398 

02399 

02400 

02401 

02402 

02403 

02404 

02405 

02406 

02407 

02408 

02409 

02410 

02411 

02412 

02413 

02414 

02415 

02416 

02417 



df87 

df89 

df8a 

df8b 

df8d 

dfSf 

df9l 

df93 

df95 

df97 

df99 

df9b 

df9d 

df9f 

dfal 

dfa4 

dfa7 

dfa8 

dfaa 

dfad 

dfbO 

dfb2 

dfb4 

dfb6 

dfb9 

dfb9 

d£b9 

dfb9 

dfb9 

dfb9 

dfbb 

dfbe 

dfcl 

dfc4 

dfc7 

dfc9 

dfca 

dfca 

dfcd 

dfdO 

dfd2 

dfd4 

dfd6 

dfd9 

dfda 



85 04 
68 
Oa 

29 le 
bO 02 
09 20 
05 04 
85 04 
a9 80 
35 8b 
05 12 
05 04 
95 8b 
bl 27 
Id 86 43 
9d 86 43 
c8 

bl 27 
9d 8b 43 
ad 4b 43 
dO 07 
aO 15 
bl 27 
8d 4b 43 



cp42 



sta 

pla 

asl 

and 

bcs 

ora 

ora 

sta 

Ida 

and 

ora 

ora 

sta 

Ida 

ora 

sta 

iny 

Ida 

sta 

Ida 

bne 

Idy 

Ida 

sta 



temp 

a 

#$le 

cp42 

#$20 

temp 

temp 

#$80 

fildat.x 

drvnum 

temp 

fildat.x 

(dirbuf),y 

filtrk.x 

filtrk,x 

(dirbuf),y 

filsec.x 

rec 

cmpchk 

#$15 

(dirbuf),y 



page ...51 



table of sector numbers in directory 
.Y contains file type 



found "<" indicating a "locked" 
file? 

file type 



replacement bit set? 



drive number, pattern 
current drive number 

drive number, pattern 
directory buffer pointer (.y=l) 
first link/track 
first link/track 

directory buffer pointer (.y=2) 

first link/sector 

record size. If not 0, 

Check table for unfound files 

move file entry's record size 
record size 



===> Check table for unfound files <== 



a9 ff 
8d 95 43 
ad 7e 43 
8d 7f 43 
ce 7f 43 
10 01 
60 

ae 7f 43 
bd 86 43 
30 02 
dO fO 
a9 00 
8d 95 43 
60 



cp50 

cmpchk Ida #$ff 
sta found 
Ida f2cnt 
sta f2ptr 

cclO dec f2ptr 
bpl ccl5 
rts 



ccl5 



cc20 



Idx f2ptr 
Ida filtrk,x 
bml cc20 
bne cclO 
Ida #0 
sta found 
rts 



set all-files-found flag 

found flag in directory searches 

move to test 

file count 

another file to find? 

no 

file number to test 

first link/track 

(if bit 7 still set, not found) 

to test next file 

all-files-found flag 

found flag in directory searches 



tests, auto initialization, lookup 



page ...52 



line 


addr 


object 


source 


code 


02418 


dfda 


=-=> Initiate search of director) 


02419 


dfda 








02420 


dfda 








02421 


dfda 








02422 


dfda 


aO 00 


srchst 


Idy #0 


02423 


dfdc 


8c 97 43 




sty delsec 


02424 


dfdf 


88 




dey 


02425 


dfeO 


8c 45 43 




sty entfnd 


02426 


dfe3 


a9 12 




Ida #18 


02427 


dfe5 


85 13 




sta track 


02428 


dfe7 


a9 01 




Ida #1 


02429 


dfe9 


85 14 




sta sector 


02430 


dfeb 


8d 99 43 




sta Istbuf 


02431 


dfee 


20 6c fO 




jsr opnird 


02432 


dffl 


ad 99 43 


srlO 


Ida Istbuf 


02433 


dff4 


dO 01 




bne srl5 


02434 


dff6 


60 




rts 


02435 


dff7 








02436 


dff7 


a9 07 


srlS 


Ida #$07 


02437 


dff9 


8d 9b 43 




sta filcnt 


02438 


dffc 


a9 00 




Ida #0 


02439 


dffe 


20 ef fO 




Jar drdbyt 


02440 


eOOl 


8d 99 43 




sta Istbuf 


02441 


e004 


20 el fO 


sr20 


jsr getpnt 


02442 


e007 


ce 9b 43 




dec filcnt 


02443 


eOOa 


aO 00 




Idy #0 


02444 


eOOc 


bl 27 




Ida (dirbuf),y 


02445 


eOOe 


dO 18 




bne sr30 


02446 


eOlO 


ad 97 43 




Ida delsec 


02447 


e013 


dO 2e 




bne search 


02448 


e015 


20 3b f9 




jsr curblk 


02449 


e018 


a5 14 




Ida sector 


02450 


eOla 


8d 97 43 




sta delsec 


02451 


eOld 


a5 27 




Ida dirbuf 


02452 


eOlf 


ae 98 43 




Idx delind 


02453 


e022 


8d 98 43 




sta delind 


02454 


e025 


fO Ic 




beq search 


02455 


e027 


60 




rts 


02456 


e028 








02457 


e028 


a2 01 


sr30 


Idx #1 


02458 


e02a 


ec 98 43 




cpx delind 


02459 


e02d 


dO 2c 




bne srSO 


02460 


e02f 


fO 12 




beq search 


02461 


e031 








02462 


e03l 








02463 


e031 









Returns with valid entry (DELIND=0) 

or with the first deleted 

entry (DELIND=l) 

SRCHST will initiate a search — 

SEARCH will continue a search 

initiate deleted sector 

sector of first available entry 

$ff 

directory entry found flag 

start search at beginning 

current track number 

last-sector-in-file flag 

current sector number 

=0 if last block 

Open internal read channel (SA=17) 

-0 if last block 

(Z»l) 

8 entries (0 to 7) to examine 

counter of file entries 

read track number 

Direct read of a byte (.A = 

position) 

=0 if last block 

Get the active buffer pointer 

counter of file entries 

read file type 

deleted entry found? 
deleted entry already found 
get current sector 
current sector number 

get index to start of this entry 

bit 1: we want a deleted entry 

store pointer in .A 

we need a valid entry, not deleted 

ones 

found what we wanted (Z=0) — a 

deleted entry 

valid entry found 

looking for deleted? 

no I 

Continue search of entries 



tests, auto initialization, lookup 



page 



.53 



line addr object source code 



02464 
02465 
02466 
02467 
02468 
02469 
02470 
02471 
02472 

02473 
02474 
02475 
02476 
02477 
02478 
02479 
02480 
02481 



e031 
e031 
e031 
e033 
e035 
e038 
e03a 
e03d 
e040 

e043 
e043 
e043 
e043 
e043 
e045 
e048 
e04b 
e04d 



==> Re-entry directory search <=== 



a9 12 
85 13 
ad 96 43 
85 14 
20 6c fO 
ad 9a 43 
20 cl fO 



srre 



Ida #18 
sta track 
Ida dlrsec 
sta sector 
jsr opnird 
Ida index 
jsr setpnt 



current track number 

directory sector last used 

current sector number 

Open internal read channel (SA=17) 

current index in buffer 

Set up pointer into active data 

buffer 



===> Continue search of entries <= 



a9 ff 
8d 45 43 
ad 9b 43 
30 08 
a9 20 



02482 e04f 20 47 ee 

02483 e052 4c 04 eO 

02484 e055 

02485 e055 20 44 fO 

02486 e058 4c fl df 

02487 e05b 

02488 e05b a5 27 



search Ida #$f f 

sta entfnd 
Ida filcnt 
bmi sr40 
Ida #$20 

jsr incptr 

jmp sr20 



sr40 



jsr nxtbuf 
jmp srtO 



02489 


e05d 


8d 9a 43 


02490 


e060 


20 3b f9 


02491 


e063 


a5 14 


02492 


e065 


8d 96 43 


02493 


e068 


60 


02493 


e069 




02494 


e069 





srSO Ida dirbuf 

sta index 
jsr curblk 
Ida sector 
sta dlrsec 
rts 

.lib trnsfer 



directory entry found flag 

adjust file count 

(if none left) 

at least one more. 32 chars per 

entry! 

Increment the pointer of the active 

buffer by .A 

process It 

get next buffer of entries and 
start processing 

valid entry found; save how far we 

got 

current index in buffer 

Read track & sector from header 

current sector number 

directory sector 



transfer filename, getnam, new 



page 



.54 



line 


addr 


object 


source 


! code 




02496 


e069 


===> Transfer filename from command string to buffer <== 


02497 


e069 


On entry, .A 


= St 


tring size. 


.X = starting index, .Y = buffer 
















number 


02498 


e069 














02499 


e069 


48 




trname 


pha 






02500 


e06a 


20 a1 


eO 




jsr 


fndlmt 


Find end of string in command buffer 


02501 


e06d 


20 83 


eO 




jar 


trcmbf 


Transfer cmd buffer to another 
buffer 


02502 


e070 


68 






pla 






02503 


e071 


38 






sec 






02504 


e072 


ed 3a 


43 




sbc 


strsiz 


length of the string 


02505 


e075 


aa 






tax 




if 0, no padding needed 


02506 


e076 


fO Oa 






beq 


tn20 




02507 


e078 


90 08 






bcc 


tn20 




02508 


e07a 


a9 aO 






Ida 


#$aO 


string is short, so pad with shifted 
spaces 


02509 


e07c 


91 27 




tnlO 


sta 


(dirbuf),y 


directory buffer 


02510 


e07e 


c8 






Iny 






02511 


e07f 


ca 






dex 






02512 


e080 


dO fa 






bne 


tnlO 


as needed 


02513 


e082 


60 




tn20 


rts 






02514 


e083 














02515 


e083 














02516 


e083 


==> Transfer command 


buffer to another buffer <=== 


02517 


e083 














02518 


e083 


98 




trcmbf 


tya 




multiply buffer number by 2 


02519 


e084 


Oa 






asl 


a 




02520 


e085 


a8 






tay 






02521 


e086 


b9 29 


00 




Ida 


buftab,y 


set the 


02522 


e089 


85 27 






sta 


dirbuf 


directory buffer pointers 


02523 


e08b 


b9 2a 


00 




Ida 


buftab+l,y 




02524 


e08e 


85 28 






sta 


dirbuf+1 




02525 


e090 


aO 00 






Idy #$00 




02526 


e092 


bd 00 


43 


trio 


Ida 


cmdbuf , X 


command buffer 


02527 


e095 


91 27 






sta 


(dirbuf ),y 


directory buffer pointer 


02528 


e097 


c8 






iny 




if .y = 0, then abort 


02529 


e098 


fO 06 






beq 


tr20 




02530 


e09a 


e8 






inx 






02531 


e09b 


ec 7c 


43 




cpx 


limit 


index to last character + 1 in 
command buffer 


02532 


e09e 


90 f2 






bcc 


trio 




02533 


eOaO 


60 




tr20 


rts 






02534 


eOal 














02535 


eOal 














02536 


eOal 


— => Find 


end of 


string in command buffer <=== 


02537 


eOal 














02538 


eOal 


a9 00 




fndlmt Ida #$00 




02539 


eOa3 


8d 3a 43 




sta 


strsiz 


length of the string = 


02540 


eOa6 


8a 






txa 






02541 


e0a7 


48 






pha 






02542 


eOaS 


bd 00 


43 


fl05 


Ida 


cmdbuf , X 


command buffer 


02543 


eOab 


c9 2c 






cmp 


#'.' 


end? 


02544 


eOad 


fO 14 






beq 


fllO 





transfer filename, getnam, new 



line addr object source code 



page ...55 



02545 

02546 

02547 

02548 

02549 

02550 

02551 

02552 

02553 

02554 

02555 

02556 

02557 

02558 

02559 

02560 

02561 

02562 



eOaf 

eObI 

eOb3 

eOb6 

eOb7 

eOb9 

eObc 

eObe 

eOcl 

eOcS 

eOc6 

eOc7 

eOcB 

eOc9 

e0c9 

eOc9 

eOc9 

e0c9 



c9 3d 
fO 10 
ee 3a 43 
e8 

a9 Of 
cd 3a 43 
90 05 
ec 79 43 
90 e5 
8e 7c 43 
68 
aa 
60 



fllO 



cmp #•=• 
beq fllO 
inc strsiz 
inx 

Ida #15 
cmp strsiz 
bcc fllO 
cpx cmdsiz 
bcc fl05 
stx limit 
pla 
tax 
rts 



===> Get file name from directory 
a5 16 getnam Ida sa 



02563 eOcb 48 

02564 eOcc a5 15 

02565 eOce 48 

02566 eOcf 20 d9 eO 



02567 

02568 

02569 

02570 

02571 

02572 

02573 

02574 

02575 

02576 

02577 

02578 

02579 

02580 

02581 

02582 

02583 

02584 

02585 

02586 

02587 

02588 

02589 

02590 

02591 

02592 

02593 

02594 

02595 



eOd2 

e0d3 

e0d5 

eOd6 

e0d8 

e0d9 

eOd9 

eOd9 

e0d9 

e0d9 

eOdb 

eOdd 

eOeO 

e0e3 

eOe6 

eOe8 

eOeb 

eOed 

eOfO 

eOfl 

e0f4 

e0f4 

e0f7 

eOf9 

eOfc 

eOfe 

el 01 

el04 

el 07 



68 

85 15 
68 

85 16 
60 



pha 

Ida lindx 

pha 

jsr gnsub 

pla 

sta lindx 

pla 

sta sa 

rts 



end? 

length of the string 

maximum size 

length of the string 

command string size 

last character + I 
transfer original .X value 
from stack 



save SA and current channel number 
to stack 



Get directory entry via int. read 

channel 17 

reset LINDX and SA 



=> Get file entry subroutine <== 



a9 11 
85 16 
20 6e ed 
20 el fO 
ad 45 43 
10 Oc 
ad 93 43 
dO Oc 
20 fa el 
18 
4c a8 el 

ad 93 43 
fO If 
ce 93 43 
dO Od 
ce 93 43 
20 8c dd 
20 fa el 
38 



gnsub 



gn05 
gn050 



Ida #$ll 
sta sa 
jsr fndrch 
jsr getpnt 
Ida entfnd 
bpl gn05 
Ida drvflg 
bne gn050 
jsr msgfre 
clc 
Jmp gn45 

Ida drvflg 
beq gnlO 
dec drvflg 
bne gn051 
dec drvflg 
jsr togdrv 
jsr msgfre 
sec 



channel number 17 

current secondary address 

Find the assigned read channel 

Get the active buffer pointer 

directory entry found flag 

more files 

do other drive? 

Set up message "blocks free" 

0=0: end 

terminate 

drive search flag = 

send filename 

if -I, go do new directory 

-1 

Toggle drive number 

Set up message "blocks free" 



transfer filename, getnam, new 



page ...56 



line 


addr 


object 


source 


! code 




02596 


el08 


4c 8c dd 




Joip togdrv 


Toggle drive number 


02597 


elOb 










02598 


elOb 


a9 00 


gnOSI 


Ida #$00 


zero hi byte of 


02599 


elOd 


8d 78 43 




sta nbtemp+1 


blocks counter and 


02600 


ellO 


8d 93 43 




sta drvflg 


drive flag 


02601 


el 13 


20 b4 el 




jsr newdir 


New directory in listing 


02602 


ell6 


38 




sec 




02603 


ell7 


60 




rts 




02604 


el18 










02605 


el 18 


a2 18 


gnlO 


Idx #dirlen 


set number of blocks & adjust 
spacing 


02606 


ella 


aO Id 




Idy #29 


(e.g. 123 "program filename" prg) 


02607 


ellc 


bl 27 




Ida (dirbuf),y 


hi byte of number of blocks 


02608 


elle 


8d 78 43 




sta nbtemp+l 




02609 


el21 


fO 02 




beq gnl2 




02610 


el 23 


a2 16 




Idx #dirlen-2 




02611 


el 25 


88 


gnl2 


dey 


to point to lo of number blocks 


02612 


el 26 


bl 27 




Ida (dirbuf),y 




02613 


el 28 


8d 77 43 




sta nbtemp 


number of blocks (temporary) 


02614 


el 2b 


eO 16 




cpx #dirlen-2 




02615 


el 2d 


fO Oa 




beq gnl4 




02616 


el2f 


c9 Oa 




cmp #10 


if <10 


02617 


el31 


90 06 




bcc gnl4 




02618 


el33 


ca 




dex 


less padding needed: number is at 
least 2 digits 


02619 


el34 


c9 64 




cmp #100 


.A =• number blocks lo 


02620 


el36 


90 01 




bcc gnl4 


if <100 


02621 


el38 


ca 




dex 


less padding needed: number is at 
least 3 digits 


02622 


el 39 


20 a9 el 


gnl4 


jsr blknb 


Blank the name buffer. Y=0 


02623 


el 3c 


bl 27 




Ida (dirbuf),y 


save file type 


02624 


el3e 


48 




pha 




02625 


el3£ 


Oa 




asl a 


set C if valid unclosed file, see 
BCS in GN15) 


02626 


el40 


10 05 




bpl gnl5 


if .A<128 


02627 


el42 


a9 3c 




Ida #•<• 




02628 


el 44 


9d b5 41 




sta nambu£-l-l,x 




02629 
02630 
02631 


el 47 
el47 
el 47 










The above 


code produces "locked" 


filetypes like PRG< in the directory 


02632 


el47 


which can' 


't be scratched. The feature is NOT supported by any 


02633 


el47 


Commodore 


DOS. To lock a file, change the file type in the directory 


02634 
02635 
02636 


el 47 
el 47 
el47 


track from $8x to $Cx. Reverse this to unlock. Files CAN be renamed! 










02637 


el47 


68 


gnl5 


pla 


type 


02638 


el48 


29 Of 




and #$0f 


mask hi bits 


02639 


el4a 


a8 




tay 


use as index 


02640 


el4b 


b9 de d2 




Ida tp21at,y 


move last character of type 


02641 


el4e 


9d b4 41 




sta nambu£,x 




02642 


el51 


ca 




dex 




02643 


el 52 


b9 d9 d2 




Ida tpUst.y 


move middle character 


02644 


el55 


9d b4 41 




sta nambuf ,x 





transfer filename, getnam, new 



page 



.57 



line addr object source code 



02645 
02646 
02647 
02648 
02649 
02650 

02651 
02652 
02653 
02654 
02655 
02656 
02657 
02658 
02659 
02660 
02661 
02662 
02663 
02664 
02665 



el 58 
el 59 
el 5c 
el5f 
el 60 
el61 

el63 
el65 
el68 
el6a 
el6d 
el6e 
el70 
el72 
el75 
el 76 
el 77 
el 79 
el 7b 
el7d 
el80 



ca 

b9 d4 d2 

9d b4 41 

ca 

ca 

bO 05 

a9 2a 
9d b5 41 
a9 aO 
9d b4 41 
ca 

aO 12 
bl 27 
9d b4 41 
ca 
88 

cO 03 
bO f5 
a9 22 
9d b4 41 
e8 



02666 el81 eO 20 

02667 el83 bO Ob 

02668 el85 bd b4 41 



02669 

02670 

02671 

02672 

02673 

02674 

02675 

02676 

02677 

02678 

02679 

02680 

02681 

02682 

02683 

02684 

02685 

02686 

02687 

02688 

02689 

02690 

02691 

02692 



el88 

el 8a 

el 8c 

el8e 

el90 

el 92 

el95 

el 96 

el 98 

el 9a 

el 9c 

el9f 

ela2 

ela4 

ela7 

ela8 

ela9 

ela9 

ela9 

ela9 

ela9 

elab 

el ad 

elbO 



c9 22 
fO 04 
c9 aO 
dO fO 
a9 22 
9d b4 41 
e8 

eO 20 
bO Oa 
a9 7f 
3d b4 41 
9d b4 41 
10 fl 
20 el de 
38 
60 



gn20 



gn22 



gn30 



gn35 
gn37 



gn40 
gn45 



dex 




Ida 


typist, y 


sta 


nafflbuf,x 


dex 




dex 




bcs 


gn20 


Ida #•*• 


sta 


nambuf-t-l.x 


Ida 


#$aO 


sta 


nambuf,x 


dex 




Idy #18 


Ida 


(dirbuf),y 


sta 


nambuf ,x 


dex 




dey 




cpy 


#$03 


bcs 


gn22 


Ida #'"• 


sta 


nambuf ,x 


Inx 





cpx #$20 
bcs gn35 
Ida nambuf, X 



cmp 
beq 
cmp 
bne 
Ida 
sta 
inx 
cpx 
bcs 
Ida 
and 
sta 
bpl 
Jsr 
sec 
rts 



#"" 

gn35 

#$aO 

gn30 
tint 

nambuf, X 

#$20 

gn40 

#$7f 

nambuf , x 

nambuf ,x 

gn37 

fndfil 



==> Blank the name buffer <» 



aO lb 
a9 20 
99 b3 41 
88 



blknb 



blknbl 



Idy #nbslz 
Ida #$20 
sta narabuf-l,y 
dey 



move first character 
DEL, SEQ, PRG, USR, REL 



if C is set (see GNU) entry is 

valid 

file not closed 

shifted space between name and type 



to point to end of name 
transfer 18-2 characters to 
name buffer 



send name in quotes 

scan name for quote or shifted 
space 

when found, or end of name 
reached, 

store a " at that location, then 
AND 

any remaining characters with $7F 
to 
clear bit 7 



Continue scan of directory 



length of name buffer 



transfer filename, getnam, new 



page 



,58 



line 


addr 


object 


source 


: code 




02693 


elbl 


dO fa 




bne blknbl 




02694 


elb3 


60 




rts 




02695 


elb4 










02696 


e1b4 










02697 


elb4 


==> New directory in listing <== 


02698 


elb4 










02699 


elb4 


20 a9 el 


newdir 


jsr blknb 


Blank the name buffer 


02700 


elb7 


a9 ff 




Ida #$ff 




02701 


elb9 


85 04 




sta temp 


temporary work area 


02702 


elbb 


a6 12 




Idx drvnum 


current drive number 


02703 


elbd 


8e 77 43 




stx nbtemp 




02704 


elcO 


a9 00 




Ida #$00 




02705 


elc2 


8d 78 43 




sta nbtemp-l-l 




02706 


elc5 


bd e8 d2 




Ida ipbm,x 


BAM address hi 


02707 


elc8 


85 28 




sta dirbuf+l 


current buffer pointer hi 


02708 


elca 


a9 90 




Ida #$90 


lo byte of pointer 


02709 


elcc 


85 27 




sta dirbuf 


directory buffer pointer 


02710 


elce 


aO 16 




Idy #22 


name length 


02711 


eldO 


bl 27 




Ida ( dirbuf ),y 


test for shifted blank 


02712 


eld2 


c9 aO 




cmp #$a0 




02713 


eld4 


dO Ob 




bne nd20 




02714 


e1d6 


a9 31 




Ida #'!• 


not shifted blank, so indicate 
version #1 


02715 


eld8 


2c 




•byte $2c 


to branch to ND20 


02716 


eld9 


bl 27 


ndl5 


Ida (dirbuf ),y 


test for shifted blank 


02717 


eldb 


c9 aO 




cmp #$aO 




02718 


eldd 


dO 02 




bne nd20 




02719 


eldf 


a9 20 




Ida #$20 


not shifted, so load blank 


02720 


elel 


99 b6 41 


nd20 


sta nambuf-t-2,y 




02721 


ele4 


88 




dey 


.y>=0: more characters to do 


02722 


ele5 


10 f2 




bpl ndl5 




02723 


ele7 


a9 12 




Ida #$12 


RVS on 


02724 


ele9 


8d b4 41 




sta nambuf 




02725 


elec 


a9 22 




Ida #•"' 


quote 


02726 


elee 


8d b5 41 




sta nambuf +1 




02727 


elfl 


8d c6 41 




sta nambuf-l-18 




02728 


elf 4 


a9 20 




Ida #$20 


space 


02729 


elf6 


8d c7 41 




sta nambuf-l-19 




02730 


elf 9 


60 




rts 




02731 


el fa 










02732 


el fa 










02733 


el fa 


=«=> Set 


up message "blocks free" 


<«=. 


02734 


el fa 










02735 


elfa 


20 a9 el 


msgfre Jsr blknb 


Blank the name buffer 


02736 


elfd 


aO Ob 




Idy #m3glen-l 




02737 


elff 


b9 Ob e2 


msgl 


Ida fremsg, y 


Message "BLOCKS FREE" 


02738 


e202 


99 b4 41 




sta nambuf, y 




02739 


e205 


88 




dey 




02740 


e206 


10 f7 




bpl msgl 




02741 


e208 


4c 34 db 




Jmp numfre 




02742 


e20b 










02743 


e20b 


42 4c 4f 


fremsg .byte 'blocks free.' 


02744 


e20e 


43 4b 53 









transfer filename, getnam, new 



page 



.59 



line addr object source code 



02745 

02746 

02747 

02748 

02749 

02750 

02751 

02752 

02753 

02754 

02755 

02756 

02757 

02758 

02759 

02760 

02761 

02762 

02763 

02764 

02765 

02766 

02767 

02768 

02769 

02770 

02771 

02772 

02773 

02774 

02775 

02776 

02777 

02778 

02779 

02780 

02781 

02782 

02783 

02784 

02785 

02786 

02787 

02788 

02789 

02790 

02791 

02792 

02793 

02794 

02795 

02796 

02797 



e211 

e214 

e217 

e217 

e2l7 

e217 

e217 

e2l7 

e217 

e21a 

e21c 

e21e 

e220 

e223 

8223 

e225 

e227 

e22a 

e22d 

e22f 

e230 

e231 

e234 

e237 

e239 

e23c 

e23f 

e242 

e245 

e247 

e249 

e24c 

e24f 

e24f 

e24f 

e24f 

e24f 

e252 

e254 

e256 

e259 

e25b 

e25e 

e25e 

e260 

e261 

e263 

e264 

e266 

e268 

e269 

e26b 

e26d 



20 46 52 
45 45 2e 



msglen = *— fremsg 



=> NEW (HEADER) a disk <= 



20 10 dd 
a5 8b 
10 05 
a9 33 
4c c9 db 

29 01 
85 12 
20 35 da 
20 89 d7 
a5 12 
Oa 
aa 

ac 81 43 
cc 79 43 
fO 16 
b9 00 43 
9d 40 43 
b9 01 43 
9d 41 43 
a9 01 
85 13 
20 20 e4 
4c 5e e2 



jsr onedrv 
Ida fildat 
bpl nlOl 
Ida #badfn 
jmp cfflderr 



nlOl 



and 
sta 
Jsr 
jsr 
Ida 
asl 
tax 
Idy 
cpy 
beq 
Ida 
sta 
Ida 
sta 
Ida 
sta 
Jsr 
jnp 



#$01 

drvnum 

setlds 

setbmp 

drvnum 



filtbl+l 

cmdsiz 

n108 

cmdbuf , y 

dskid,x 

cmdbuf +l,y 

dskid+l,x 

#$01 

track 

format 

nllO 



=> Clear directory <= 



20 ff ec nl08 

aO 02 

bl 02 

cd 9f 10 

fO 03 

4c 80 fl 



a9 00 
a8 

91 02 
c8 

dO fb 
a5 12 
18 

69 Oc 
85 al 
Oa 



nllO 



nlll 



jsr initdr 
Idy #$02 
Ida (bmpnt),y 
cmp vernuffl 
beq nllO 
jmp vnerr 

Ida #$00 

tay 

sta (bmpnt),y 

iny 

bne nlll 

Ida drvnum 

clc 

adc #bamJob 

sta Jobnum 

asl a 



set up drive and table pointers 

drive number, pattern 

If bit 7 set, legal drive number 

Command level error handling 

mask off non-drive bits 

Turn on LED for current drive 
Set (indirect) BAM pointer 



get disk ID 

new or clear? 

end of command string 

command buffer 

store in proper drive 

(.Y-0) 



current track number 
transfer FORMAT to RAM 



use current version number 
"a" - DOS version number 

Version error 



clear buffer 



current drive number 

buffer number 13 + drive number 
current job number 
multiply job code 



transfer filename, getnam, new 



page ...60 



line 


addr 


object 


source code 




02798 


e26e 


aa 




tax 




02799 


e26f 


a9 


90 


Ida #$90 


disk name offset in BAM 


02800 


e271 


95 


29 


sta buftab,x 




02801 


6273 


aO 


01 


Idy #$01 




02802 


e275 


84 


14 


sty sector 


current sector number 


02803 


e277 


a9 


ff 


Ida #$ff 




02804 


e279 


91 


02 


sta (bmpnt),y 


bit map pointer 


02805 


e27b 


a9 


12 


Ida #18 




02806 


e27d 


85 


13 


sta track 


current track number 


02807 


e27f 


20 


5b fO 


jsr drtwrt 


clear directory 


02808 


e282 


20 


76 e7 


Jsr newmap 


new BAM 


02809 


e285 


aO 


02 


Idy #$02 




02810 


e287 


ad 


9f 10 


Ida vernuio 


"a" - DOS version number 


028H 


e28a 


91 


02 


sta (bmpnt),y 




02812 


e28c 


20 


9f eb 


Jsr usedts 


used 18.1 


02813 


e28f 


c6 


14 


dec sector 


current sector number 


02814 


e291 


20 


9f eb 


jar usedts 


used 18.0 


02815 


e294 


a4 


al 


Idy Jobnum 


current Job number 


02816 


e296 


ae 


80 43 


Idx filtbl 


filtbl ; table of filename pointers 


02817 


e299 


a9 


27 


Ida #$27 




02818 


e29b 


20 69 eO 


Jsr trname 


Transfer filename from command 












string to buffer 


02819 


e29e 


aO 


12 


Idy #$12 




02820 


e2a0 


a5 


12 


Ida drvnum 


set up current ID 


02821 


e2a2 


Oa 




asl a 




02822 


e2a3 


aa 




tax 




02823 


e2a4 


bd 


40 43 


Ida dskld.x 




02824 


e2a7 


91 


27 


sta (dirbuf),y 




02825 


e2a9 


c8 




iny 




02826 


e2aa 


bd 


41 43 


Ida dskid+l.x 




02827 


e2ad 


91 


27 


sta (dirbuf),y 


directory buffer pointer 


02828 


e2af 


c8 




iny 




02829 


e2bO 


c8 




iny 




02830 


e2bl 


a9 


04 


Ida #dosver+2 




02831 


e2b3 


91 


27 


sta (dirbuf),y 




02832 


e2b5 


c8 




iny 




02833 


e2b6 


ad 


9f 10 


Ida vernum 


show version number 


02834 


e2b9 


91 


27 


sta (dirbuf),y 




02835 


e2bb 


20 


5b fO 


Jsr drtvnrt 


write it out 


02836 


e2be 


4c 


9f db 


Jmp endcffld 


Terminate command successfully 


02836 


e2cl 










02837 


e2cl 






.lib scrtch 





scratch file(s), copy, rename 



page 



.61 



line addr object source code 



02839 e2cl 

02840 e2cl 

02841 e2cl 

02842 e2c4 

02843 e2c7 



02844 

02845 

02846 

02847 

02848 

02849 

02850 

02851 

02852 

02853 

02854 

02855 

02856 

02857 

02858 

02859 

02860 

02861 

02862 

02863 

02864 

02865 

02866 

02867 

02868 

02869 

02870 

02871 

02872 

02873 

02874 

02875 

02876 

02877 

02878 

02879 

02880 

02881 

02882 

02883 

02884 

02885 

02886 



e2ca 

e2cc 

e2ce 

e2dl 

e2d3 

e2d3 

e2d3 

e2d3 

e2d3 

e2d6 

e2d8 

e2d8 

e2d8 

e2d8 

e2d8 

e2da 

e2dc 

e2de 

e2e0 

e2e0 

e2e3 

e2e5 

e2e7 

e2e9 

e2eb 

e2ec 

e2ee 

e2£0 

e2f3 

e2f3 

e2f3 

e2f3 

e2f3 

e2f6 

e2f8 

e2fa 

e2fc 

e2fc 

e2ff 

e301 

e303 

e306 

e308 



02887 e30b 

02888 e30d 



===> Scratch one or more files <= 
20 95 dd scrtch jsr f si set 



20 1e dd 
20 10 de 

a9 00 
85 19 
20 c9 de 
30 3f 



jsr alldrs 
jsr optsch 

Ida #$00 
sta rO 
jsr ffst 
binl sc30 



Set pointers to one file stream and 
check type 

Set up all drives from F2CNT 
Determine optimal search for LOOKUP 
and FINFIL 

use as file count 

Find starting entry in directory 



The following code prevents freeing the sectors 
of an unclosed file 



20 bf f8 
90 35 



scl5 



jsr tstchn 
bcc sc25 



Test for active files 
yes — don't scratch 



The following code prevents scratching a locked filename 
(bit 6 set) 



aO 00 
b1 27 
29 40 
dO 2d 



Idy #$00 
Ida (dirbuf),y 
and #%01000000 
bne sc25 



lock bit 
it's locked 



20 45 e3 
aO 13 
bl 27 
fO Oa 
85 13 
c8 

bl 27 
85 14 
20 Id e3 



jsr deldir 

Idy #19 

Ida (dirbuf),y 

beq scl7 

sta track 

Iny 

Ida (dirbuf),y 

sta sector 

jsr delfil 



Delete the entry in the directory 

a relative? 

with a side sector? 

no 

yes — save track number 

get sector 

Delete by links 



This prevents freeing a file's sectors if its replacement was 
Incomplete (bit 5 set) 



ae 45 43 
a9 20 
35 8b 
dO Of 



scl7 



Idx entfnd 
Ida #$20 
and fildat.x 
bne sc20 



directory entry found flag 

drive number, pattern 
created — not closed 



bd 86 43 
29 7f 
85 13 
bd 8b 43 
85 14 
20 Id e3 

e6 19 
20 b7 de 



sc20 
sc25 



Ida filtrk,x 
and #%Onmil 
sta track 
Ida filsec.x 
sta sector 
jsr delfil 

inc rO 
jsr ffre 



delete by links 



free the file blocks by updating the 

BAM 

set file counter to 

find next name in file stream and 

table entry 



scratch file(s), copy, rename 



page 



.62 



line 


addr 


object 


source 


code 




02889 


e310 


10 cl 




bpl scl5 




02890 


e312 


a5 19 


sc30 


Ida rO 


finished, set 


02891 


e314 


85 13 




sta track 


number of files that have been 
scratched 


02892 


e316 


a9 01 




Ida #$0l 




02893 


e318 


aO GO 




Idy #$00 




02894 


e3la 


4c a9 db 




jmp scrend 


Scratch entry 


02895 


e31d 










02896 


e31d 










02897 


e31d 


=> Delete a file by links <=== 




02898 


e3ld 










02899 


e31d 


20 Ic da 


delfil 


Jsr frets 


Free track/sector in BAM 


02900 


6320 


20 6c fO 




Jsr opnird 


update BAM 


02901 


e323 


a9 00 


del2 


Ida #$00 




02902 


e325 


20 cl fO 




jsr setpnt 


Set up pointer into active data 
buffer 


02903 


e328 


20 d7 ed 




jsr rdbyt 


Read byte from file 


02904 


e32b 


85 13 




sta track 


current track number 


02905 


e32d 


20 d7 ed 




jsr rdbyt 


Read byte from file 


02906 


e330 


85 14 




sta sector 


current sector number 


02907 


e332 


a5 13 




Ida track 


current track number 


02908 


e334 


dO 06 




bne dell 




02909 


e336 


20 55 f6 




jsr mapout 


Write out BAM to drive specifie 
LSTJOB 


02910 


e339 


4c a4 ee 




jmp frechn 


Free channel associated with SA 


02911 


e33c 










02912 


e33c 


20 Ic da 


dell 


jsr frets 


Free track/sector in BAM 


02913 


e33f 


20 44 fO 




jsr nxtbuf 


read next block using t/s link 


02914 


e3A2 


4c 23 e3 




jmp del2 


deallocate new block 


02915 


e345 










02916 


e345 










02917 


e345 


===> Delete the entry in the directory <=« 


02918 


e345 










02919 


e345 


aO 00 


deldii 


■ Idy #$00 




02920 


e347 


98 




tya 




02921 


e348 


91 27 




sta (dirbuf),y 


directory buffer pointer 


02922 


e34a 


20 60 f9 




jsr wrtout 


store write job code $90 


02923 


e34d 


4c 87 ec 




jmp watjob 


Wait until job is completed 


02924 


e350 










02925 


e350 










02926 


e350 


=— > Duplicate disk <= 




02927 


e350 










02928 


e350 


20 a8 e4 


duplet jsr prseq 




02929 


e353 


a5 8c 




Ida fildat+1 




02930 


e355 


85 12 




sta drvnum 


current drive number 


02931 


e357 


a9 18 




Ida #ledOtledl 




02932 


e359 


Od 82 02 




ora pbd2 




02933 


e35c 


8d 82 02 




sta pbd2 




02934 


e35f 


20 f£ ec 




jsr initdr 




02935 


e362 


20 89 d7 




jsr setbmp 


Set (indirect) BAM pointer 


02936 


e365 


aO 02 




Idy #$02 




02937 


e367 


bl 02 




Ida (bmpnt),y 


bit map pointer 


02938 


e369 


cd 9f 10 




cmp vernum 


"a" - DOS version number 



scratch file(s), copy, rename 



page 



.63 



line addr object source code 



02939 

02940 

02941 

02942 

02943 

02944 

02945 

02946 

02947 

02948 

02949 

02950 

02951 

02952 

02953 

02954 

02955 

02956 
02957 
02958 
02959 
02960 
02961 
02962 
02963 
02964 

02965 

02966 

02967 

02968 

02969 

02970 

02971 

02972 

02973 

02974 

02975 

02976 

02977 

02978 

02979 

02980 

02981 

02982 

02983 

02984 

02985 

02986 

02987 

02988 

02989 



e36c 
e36e 
e371 
6371 
e374 
e375 
e376 
e378 
e379 
e37c 
e37f 
e382 
e385 
e388 
e38a 
e38d 
e38f 

e392 
e394 
e396 
e399 
e399 
e399 
e399 
e399 
e39b 

e39e 

e3a0 

e3a2 

e3a5 

e3a7 

e3a9 

e3ab 

e3ad 

e3b0 

e3b3 

e3b3 

e3b3 

e3b3 

e3b3 

e3b6 

e3b9 

e3bc 

e3be 

e3c0 

e3cl 

e3cl 

e3c3 

e3c5 

e3c8 

e3ca 



fO 03 
4c 80 fl 

20 8c dd 

Oa 

a8 

49 02 

aa 

bd 40 43 

99 40 43 

bd 41 43 

99 41 43 

20 89 d7 

aO 02 

ad 9f 10 

91 02 

20 54 ef 

a9 01 
85 13 
20 20 e4 



dupl 



beq dupl 
jmp vnerr 

jsr togdrv 

asl a 

tay 

eor #$02 

tax 

Ida dskid.x 

sta dskld,y 

Ida dskld+I,x 

sta dskid+l,y 

jsr setbmp 

Idy #$02 

Ida vernum 

sta (bmpnt),y 

Jsr cldchn 

Ida #$01 
sta track 
jsr format 



Version error 
Toggle drive number 

current id drive #0 

Set (indirect) BAM pointer 

"a" - DOS version number 
bit map pointer 
Close all channels except the 
command channel 

current track number 
Format a diskette routine 



===> Copy blocks to the other drive <=== 



a5 13 
20 db d7 

85 14 
c6 14 
20 b3 e3 
e6 13 
a5 13 
c9 24 
dO ec 
20 ff ec 
4c 9f db 



cpydl 



Ida track 
jsr maxsec 

sta sector 
dec sector 
jsr cpytrk 
inc track 
Ida track 
cmp #maxtrk 
bne cpydl 
jsr initdr 
Jmp endcmd 



current track number 

Tell how many sectors allowed for 

this track 

current sector number 

Copy one track 
current track number 



Copy blocks to the other drive 



===> Copy one track <= 



20 c1 e3 
20 dc e3 
20 00 e4 
a5 14 
10 f3 
60 

a5 12 
49 01 
8d 3c 43 
a9 Oa 
85 06 



cpytrk jsr setrh 
jsr reads 
jsr writes 
Ida sector 
bpl cpytrk 
rts 



setrh 



Ida drvnum 
eor #1 
sta cmd 
Ida #10 
sta t2 



Read 10 sectors 
Write 10 sectors 
current sector number 
Copy one track 



current drive number 
temporary job conmand 



scratch file(s), copy, rename 



page ...64 



line 


addr 


object 


source 


code 




02990 


e3cc 


a5 06 


setr3 


Ida t2 




02991 


e3ce 


20 97 ec 




jsr seth 




02992 


e3d1 


c6 14 




dec sector 




02993 


e3d3 


30 06 




bml setr6 




02994 


e3d5 


c6 06 




dec t2 




02995 


e3d7 


10 f3 




bpl setr3 




02996 


e3d9 


e6 06 




inc t2 




02997 


e3db 


60 


setr6 


rts 




02998 
02999 


e3dc 
e3dc 










03000 


e3dc 


=> Read T2 blocks in <== 




03001 


e3dc 










03002 


e3dc 


ad 3c 43 


reads 


Ida cmd 




03003 


e3df 


09 80 




ora #read 




03004 


e3el 


8d 3c 43 




sta cmd 




03005 


e3e4 


a6 06 




Idx t2 




03006 


e3e6 


ad 3c 43 


readsl 


Ida cmd 




03007 


e3e9 


20 16 fl 




jsr setjob 


Set up new job 


03008 


e3ec 


eO Oa 




cpx #10 




03009 


e3ee 


£0 03 




beq reads8 




03010 


e3f0 


e8 




inx 




03011 


e3fl 


dO f3 




bne readsl 




03012 


e3f3 


a6 06 


readsS 


Idx t2 




03013 


e3f5 


20 87 ec 


reads3 


jsr watjob 


Wait until job is com] 


03014 


e3f8 


eO Oa 




cpx #10 




03015 


e3fa 


fO 03 




beq read I 5 




03016 


e3fc 


e8 




inx 




03017 


e3fd 


dO f6 




bne reads3 




03018 


e3ff 


60 


read 15 


rts 




03019 


e400 










03020 


6400 










03021 


e400 


==> Write T2 buffers out <== 




03022 


e400 










03023 


e400 


a9 90 


writes 


Ida #vnrite 




03024 


e402 


05 12 




ora drvnum 


current drive number 


03025 


e404 


8d 3c 43 




sta cmd 


temporary job command 


03026 


e407 


a6 06 




Idx t2 




03027 


e409 


20 16 fl 


writO 


jsr setjob 


Set up new job 


03028 


e40c 


eO Oa 




cpx #10 




03029 


e40e 


fO 03 




beq writ5 




03030 


e410 


e8 




inx 




03031 


e411 


dO f6 




bne writO 




03032 


e4l3 


a6 06 


vn:it5 


Idx t2 




03033 


e415 


20 87 ec 


writlO 


1 jsr watjob 


Wait until job is com 


03034 


e418 


eO Oa 




cpx #10 




03035 


e41a 


fO 03 




beq writ20 




03036 


e4lc 


e8 




inx 




03037 


e41d 


dO f6 




bne writlO 




03038 


e41f 


60 


writ2C 


1 rts 




03039 


e420 










03040 


e420 











scratch file(s), copy, rename 



line addr object source code 



page 



.65 



03041 

03042 

03043 

03044 

03045 

03046 

03047 

03048 

03049 

03050 

03051 

03052 

03053 

03054 

03055 

03056 

03057 

03058 

03059 

03060 

03061 

03062 

03063 

03064 

03065 

03066 

03067 

03068 

03069 

03070 

03071 

03072 

03073 

03074 

03075 

03076 

03077 

03078 

03079 

03080 

03081 

03082 

03083 

03084 

03085 

03086 

03087 

03088 

03089 

03090 

03091 

03092 

03093 



e420 

e420 

e420 

e420 

e420 

e422 

e425 

e428 

e42b 

e42e 

e431 

e434 

e435 

e437 

e439 

e43c 

e43e 

e440 

e443 

e446 

e448 

e44a 

e44c 

e44e 

e450 

e453 

e453 

e454 

e454 

e454 

e454 

e454 

e457 

e459 

e45c 

e45e 

e460 

e463 

e466 

e467 

e46a 

e46c 

e46f 

e470 

e473 

e476 

e476 

e479 

e47c 

e47f 

e48l 

e483 

e486 



=> Format a diskette routine <== 



Transfer format to buffer and start Controller formatting 



aO 00 
b9 00 dO 
99 00 11 
b9 00 dl 
99 00 12 
b9 00 d2 
99 00 13 
c8 

dO eb 
a9 00 
20 97 ec 
a5 12 
09 eO 
8d 03 
ad 03 
30 fb 
c9 01 
fO 07 
a9 03 
a2 00 
4c 25 d9 

60 



10 
10 



format Idy #$00 
fmtl02 Ida code.y 
sta bufs,y 
Ida code+256,y 
sta bufs+256,y 
Ida code+512,y 
sta bufs+512,y 
Iny 

bne fmt102 
Ida #$00 
jsr seth 
Ida drvnum 
ora #exec 
sta jobs 
fmtlOS Ida jobs 

bmi fmtlOS 
crop #$01 
beq fmtllO 
Ida #$03 
Idx #$00 
jmp error 

fmtllO rts 



current drive number 
job queue definitions 



Handle errors reported by controller 



> Disk Copy <= check for type and parse special case 



20 e6 db dskcpy jsr prscln 

dO Id bne dxOOOO 

20 a8 e4 jsr prseq 

a9 2a Ida #'*' 

a2 27 idx #39 

8e 81 43 atx filtbl+l 

9d 00 43 sta cmdbuf.x 

e8 inx 

8e 79 43 stx cmdsiz 

a2 01 Idx #$01 

8e 7d 43 stx flcnt 

e8 inx 

8e 7e 43 stx f2cnt 

4c eb e4 jmp movlp2 

20 f9 db dxOOOO Jsr tc30 

20 le dd jsr alldrs 

ad 91 43 Ida image 

29 55 and #%01010101 

dO lb bne dx0020 

ae 80 43 idx filtbl 

bd 00 43 Ida cmdbuf.x 



Find colon in command string 



copy all 

put at buffer end 

place * 

command string size 
set up counts 



enter routine 

normal parse 

Set up all drives from F2CNT 

get parse image 

value for patern copy 

must be concat or normal 

check for * 



scratch file(s), copy, rename 



page 



,66 



line addr object 



03094 

03095 

03096 

03097 

03098 

03099 

03100 

03101 

03102 

03103 

03104 

03105 

03106 

03107 

03108 

03109 

03110 

031 1 1 

03112 

03113 

03114 

03115 

03116 

03117 

03118 

03119 

03120 

03121 

03122 

03123 

03124 

03125 

03126 

03127 

03128 

03129 

03130 

03131 

03132 

03133 

03134 

03135 

03136 

03137 

03138 

03139 

03140 

03141 

03142 

03143 

03144 

03145 



e489 

e48b 

e48d 

e48f 

e492 

e493 

e496 

e499 

6499 

e49b 

e49e 

e49e 

e4a1 

e4a3 

e4a5 

e4a8 

e4a8 

e4aa 

e4ad 

e4af 

e4bl 

e4b4 

e4b4 

e4b7 

e4ba 

e4bc 

e4be 

e4bf 

e4c0 

e4c3 

e4c6 

e4c8 

e4ca 

e4cc 

e4ce 

e4cf 

e4cf 

e4cf 

e4cf 

e4cf 

e4d2 

e4d4 

e4d6 

e4d9 

e4dc 

e4dd 

e4de 

e4el 

e4e4 

e4e6 

e4e8 

e4eb 



c9 2a 

dO 11 

a2 01 

8e 7d 43 

e8 

8e 7e 43 

4c c£ e4 

a9 30 
4c c9 db 

ad 91 43 
25 d9 
dO f4 
4c 8e e5 

a9 3d 
20 69 dc 
dO 05 
a9 30 
4c c9 db 

b9 00 43 
20 bb dd 
30 f3 
85 8c 
88 
88 

b9 00 43 
20 bb dd 
30 e7 
c5 8c 
£0 e3 
85 8b 
60 



source code 

cmp #'*• 

bne dx0020 

Idx #$01 

stx flcnt 

Inx 

stx f2cnt 

Jmp cpydtd 

dxOOlO Ida #badsyn 
Jmp cmderr 

dx0020 Ida Image 

and ZllOllOOl 
bne dxOOlO 
jmp copy 



prseq 



x0015 



Ida #'=• 
jsr parse 
bne x0020 
Ida #badsyn 
jmp cmderr 



x0020 Ida 
jsr 
bml 
sta 
dey 
dey 
Ida 
jsr 
bml 
cmp 
beq 
sta 
rts 



cmdbuf ,y 
tstOvl 
x0015 
flldat+1 



cmdbuf ,y 

tstOvl 

X0015 

fildat+1 

x0015 

flldat 



set counts 

Copy disk to disk routines 

check for normal 

Copy flle(s) to one file 
special case 



command buffer 
Test for or 1 

source drive 



=> Copy disk to disk routines <= 



ad 81 43 
85 04 
aO 28 
ae 79 43 
8c 79 43 
88 
ca 

bd 00 43 
99 00 43 
e4 04 
dO f4 
8c 81 43 
20 10 de 



cpydtd Ida 
sta 
Idy 
Idx 
sty 

movlpl dey 
dex 
Ida 
sta 
cpx 
bne 
sty 

movlp2 jsr 



filtbl+1 

temp 

#40 

cmdsiz 

cmdslz 



cmdbuf , X 

cmdbuf ,y 

temp 

movlpl 

filtbl+l 

optsch 



can't be equal 
destination drive 



save in temp 

40-character buffer 
prepare to move 
end of fllename2 



move filename last-in, first-out 

actual f2 value 

pointer to f2 

Determine optimal search for LOOKUP 

and FINFIL 



scratch file(s), copy, rename 



page ...67 



line addr object source code 



03146 

03147 

03148 

03149 

03150 

03151 

03152 

03153 

03154 

03155 

03156 

03157 

03158 

03159 

03160 

03161 

03162 

03163 

03164 

03165 

03166 

03167 

03168 

03169 

03170 

03171 

03172 

03173 

03174 

03175 

03176 

03177 

03178 

03179 

03180 

03181 

03182 

03183 

03184 

03185 

03186 

03187 

03188 

03189 

03190 

03191 

03192 
03193 
03194 
03195 
03196 
03197 



e4ee 

e4fl 

e4f4 

e4f6 

e4f8 

e4f9 

e4fc 

e4fd 

e500 

e501 

e504 

e505 

e508 

e509 

eSOc 

e50d 

e510 

e511 

e514 

e515 

e518 

eSlb 

e51e 

e520 

e523 

e523 

e526 

e527 

e52a 

e52b 

e52e 

e52f 

e532 

e533 

e536 

e537 

e53a 

e53b 

e53e 

e53f 

e542 

e543 

e546 

e548 

e54b 

e54e 

e551 
e553 
e556 
e558 
e55b 
e55e 



20 71 e5 

20 c9 de 

10 2d 

30 28 

68 

8d 96 43 

68 

8d 81 43 

68 

8d 99 43 

68 

8d 9b 43 

68 

8d 9a 43 

68 

8d 95 43 

68 

8d 98 43 

68 

8d 93 43 

20 71 e5 

20 b7 de 

10 03 

4c 9f db 

ad 93 43 

48 

ad 98 43 

48 

ad 95 43 

48 

ad 9a 43 

48 

ad 9b 43 

48 

ad 99 43 

48 

ad 81 43 

48 

ad 96 43 

48 

20 61 e5 

a9 01 

8d 7d 43 

8d 7e 43 

20 7a de 



jsr 

jsr 

bpl 

bml 

exlpO pla 

sta 

pla 

sta 

pla 

sta 

pla 

sta 

pla 

sta 

pla 

sta 

pla 

sta 

pla 

sta 

Jsr 

J3r 

bpl 

endlt jmp 

fixit Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
pha 
jsr 
Ida 
sta 
sta 
Jsr 



pupsl 
ffst 
fixit 
endit 

dlrsec 

filtbl+l 

Istbuf 

filcnt 

index 

found 

delind 

drvflg 

pupsl 

ffre 

fixit 

endcmd 

drvflg 

delind 

found 

index 

filcnt 

Istbuf 

flltbl+l 

dlrsec 

trfnme 

#$01 

flcnt 

f2cnt 

lookup 



set-up first pass 

first match 

entry found? 

no 

pull needed variables 



set up variables 
next match 
found one? 
no, so goodbye I 

push needed variables 



a9 01 
8d 7d 43 
a9 02 
8d 7e 43 
20 da e5 
4c f8 e4 



Ida #$01 
sta flcnt 
Ida #$02 
sta f2cnt 
jsr cy 
Jmp exlpO 



Transfer name (DIRBUF) to CMDBUF 
fake out LOOKUP 



Look up files in cmd string in 
directory & fill tables 

real 

copy it 

now do next one 



scratch file(s), copy, rename 



page ...68 



line 


addr 


object 


source 


code 




03198 


e561 










03199 


e561 










03200 


e56l 


==> Transfer name (DIRBUF) to CMDBUF <= 


03201 


e56l 










03202 


e561 


aO 03 


trfnine 


Idy #$03 


both indices 


03203 


e563 


8c 80 43 




sty filtbl 


beginning of filenamel 


03204 


8566 


bl 27 


trfO 


Ida (dirbuf),y 


move it 


03205 


e568 


99 00 43 




sta cmdbuf,y 


comoand buffer 


03206 


e56b 


c8 




iny 




03207 


e56c 


cO 13 




cpy #19 


all 16 characters passed? 


03208 


e56e 


dO f6 




bne trfO 




03209 


e570 


60 




rts 




03210 


e57l 










03211 


e57l 










03212 


e571 


===> Set-up subroutine <= 




03213 


e571 










03214 


e571 


a9 00 


pupsl 


Ida #$00 




03215 


e573 


8d 92 43 




sta drvcnt 


number of drive searches 


03216 


e576 


8d 86 43 




sta filtrk 


first link/track 


03217 


e579 


8d 87 43 




sta filtrk+1 




03218 


e57c 


a5 8c 




Ida fildat+l 


get drive number 


03219 


e57e 


29 01 




and #$0l 


only 


03220 


e580 


85 12 




sta drvnum 


current drive number 


03221 


e582 


09 01 




ora #$01 




03222 


e584 


8d 97 43 




sta delsec 


non-zero 


03223 


e587 


ad 81 43 




Ida flltbl+l 


fnl - fn2 


03224 


e58a 


8d 80 43 




sta filtbl 


table of filename pointers 


03225 


e58d 


60 




rts 




03226 


e58e 










03227 


e58e 










03228 


e58e 


=> Copy file(s) 


to one file <== 


s 


03229 


e58e 










03230 


e58e 


20 7a de 


copy 


jsr lookup 


Look up files in cmd string in 
directory & fill tables 


03231 


e591 


ad 7e 43 




Ida f2cnt 


number of filenames 


03232 


e594 


c9 03 




cmp #$03 


fewer than 3, not concatenate 


03233 


e596 


90 3c 




bcc coplO 


copy file 


03234 


e598 


a5 8b 




Ida fildat 


drive number, pattern 


03235 


e59a 


c5 8c 




cmp fildat+l 


if unequal, not concatenate 


03236 


e59c 


dO 36 




bne coplO 


copy file 


03237 


e59e 


a5 86 




Ida filent 


table of sector numbers in directory 


03238 


e5aO 


c5 87 




cmp filent+l 


if unequal, not concatenate 


03239 


e5a2 


dO 30 




bne coplO 


Copy file 


03240 


eSa4 










03241 


e5a4 










03242 


e5a4 


=■> Concatenate files <==■ 




03243 


e5a4 










03244 


e5a4 


20 c3 e6 




jsr chkin 


check if input file exists 


03245 


e5a7 


a9 01 




Ida #$01 




03246 


e5a9 


8d 7f 43 




sta f2ptr 


file stream 2 pointer 


03247 


e5ac 


20 le e6 




jsr opirfl 


Open Internal read channel to read 
file 


03248 


e5af 


20 a6 ed 




jsr typfil 


Get current file type 



scratch file(s), copy. 



line addr object source code 



page ...69 



03249 
03250 
03251 
03252 
03253 
03254 
03255 
03256 
03257 
03258 
03259 
03260 

03261 

03262 

03263 

03264 

03265 

03266 

03267 

03268 

03269 

03270 

03271 

03272 

03273 

03274 

03275 

03276 

03277 

03278 

03279 



e5b2 
e5b4 
e5b6 
e5b8 
e5ba 
e5bd 
e5bf 
e5cl 
e5c3 
e5c5 
e5c7 
e5c9 

e5cc 

e5ce 

e5dl 

e5d4 

e5d4 

e5d7 

e5da 

e5da 

e5da 

e5da 

e5da 

e5dd 

eSdf 

e5el 

e5e3 

e5e6 

e5e9 

eSec 

e5ef 



fO 04 
c9 02 
dO 05 
a9 64 
20 c9 
a9 12 
85 16 
a5 b3 
85 b4 
a9 ff 
85 b3 
20 d£ 



db 



f4 



a2 02 
20 ec e5 
4c 9f db 

20 da e5 
4c 9f db 



beq copOl 


cmp 


#prgtyp 


bne 


cop05 


copOl Ida 


#mistyp 


Jsr 


cmderr 


cop05 Ida #iw3a 


sta 


sa 


Ida 


lintab+irsa 


sta 


llntab+iwsa 


Ida 


#$ff 


sta 


llntab+lrsa 


Jsr 


append 


Idx 


#$02 


jsr 


cylO 


Jmp endcmd 


coplO jsr 


cy 


jmp endcmd 



==> Copy file <=. 

20 eO e6 
a5 8b 
29 01 
85 12 
20 7c fO 
20 a9 fl 
ae 7d 43 
8e It 43 
20 le e6 



03280 

03281 

03282 

03283 

03284 

03285 

03286 

03287 

03288 

03289 

03290 

03291 

03292 

03293 

03294 

03295 

03296 

03297 

03298 



e5f2 
e5f4 
e5f6 
e5f9 
e5f9 
e5fc 
e5ff 
e601 
e604 
e606 
e609 
e60b 
e60e 

6611 

e612 
e615 
e617 
e619 
e61b 



a9 08 
85 aO 
4c fc e5 

20 eb eb 
20 5e e6 
a9 80 
20 ae 
fO f3 
20 a6 
fO 03 
20 eb eb 
ae 7f 43 
e8 

ec 7e 43 
90 d5 
a9 12 
85 16 
4c ba f 5 



f8 



ed 



cy 


jsr chkio 




Ida fildat 




and #$01 




sta drvnum 




jsr opnirw 




jsr addfil 




Idx flcnt 


cylO 


stx f2ptr 




jsr opirfl 




Ida #eoisnd 




sta eoiflg 




Jmp cy20 


cyl5 


jsr pibyte 


cy20 


Jsr gibyte 




Ida #lrf 




Jsr tstflg 




beq cyl5 




jsr typfil 




beq cy30 




Jsr pibyte 


cy30 


Idx f2ptr 




inx 




cpx f2cnt 




bcc cylO 




Ida #iwsa 




sta sa 




Jmp clschn 



means a scratched file 
if not 2, 
not deleted 

Command level error handling 

current secondary address 



deactivate 

Read file, then append info to the 
end of it 

copy 2nd file behind 1st 
Terminate command successfully 

Terminate command successfully 



Check existence of I/O file 
drive number, pattern 

current drive number 

Open internal write channel (SA=18) 

Add new filename to directory 

set op read file 

Open internal read channel to read 

file 

current EOI status 



Write byte to internal channel 

Get byte from internal read channels 

Test flag 

Get current file type 

Write byte to internal channel 
check if more files to copy 

if carry clear, 
more files to copy 

current secondary address 

Close file with specified secondary 

address 



scratch file(s),-copy, rename 



page 



.70 



line addr object 



source code 



03299 
03300 
03301 
03302 
03303 
03304 
03305 
03306 
03307 
03308 
03309 
03310 
03311 
03312 
03313 
03314 
03315 
03316 
03317 

03318 
03319 
03320 
03321 
03322 
03323 
03324 
03325 
03326 
03327 
03328 
03329 
03330 
03331 

03332 
03333 
03334 
03335 
03336 
03337 
03338 
03339 
03340 

03341 
03342 
03343 
03344 
03345 
03346 
03347 
03348 



e61e 
e61e 
e61e 
e6le 
e61e 
e621 
e623 
e625 
e627 
e629 
e62b 
e62d 
e62f 
e631 
e634 
e637 
e639 
e63b 
e63d 

e640 
e643 
e645 
e647 
e648 
e64a 
e64c 
e64f 
e652 
e654 
e657 
e659 
e65a 
e65b 

e65e 
e65e 
e65e 
e65e 
e660 
e662 
e665 
e667 
e669 

e66b 
e66d 
e66f 
e671 
e674 
e676 
e678 
e67b 



===> Open internal read channel to read file <=== 



ae 7f 43 
b5 8b 
29 01 
85 12 
a9 12 
85 13 
b5 86 
29 If 
85 14 
20 6c fO 
ae 7f 43 
b5 86 
29 70 
09 02 
20 cl fO 

ae 7f 43 

b5 8b 

29 Oe 

4a 

85 c5 

a9 00 

8d 4b 43 

20 5b f4 

aO 01 

20 a6 ed 

fO 01 

c8 

98 

4c cl fO 



opirfl Idx 
Ida 
and 
sta 
Ida 
sta 
Ida 
and 
sta 
Jsr 
Idx 
Ida 
and 
ora 
Jsr 



f2ptr 

fildat.x 

#$01 

drvnun 

#18 

track 

fllent.x 

#%nui 

sector 

opnird 

f2ptr 

filent,x 

#%1 1 lOOOO 

#$02 

setpnt 



Idx f2ptr 
Ida fildat,x 
and #typDsk 
Isr a 
sta type 
Ida #$00 
sta rec 
jsr opread 
Idy #$0l 
jsr typfil 
beq oplrlO 
iny 
opirlO tya 

Jmp setpnt 



file stream 2 pointer 
drive number, pattern 

current drive number 

current track number 

table of sector numbers in directory 

current sector number 

Open internal read channel (SA=17) 

file stream 2 pointer 

table of sector numbers in directory 



Set up pointer into active data 

buffer 

file stream 2 pointer 

drive number, pattern 



current file type 

not relative 

Open a file to read 

Get current file type 

if Z set (not relative file) 



Set up pointer into active data 
buffer 



=> Get byte from internal read channels <= 



a9 11 gibyte Ida #lrsa 
85 16 sta sa 

20 95 ef gcbyte jsr gbyte 
85 18 sta data 

a6 15 Idx lindx 

b5 98 Ida chnrdy.x 

29 08 and #eoisnd 

85 aO sta eoiflg 

dO Oa bne glb20 

20 a6 ed jsr typfil 
fO 05 beq gib20 

a9 80 Ida #lrf 

20 9f f8 jsr setflg 

60 gib20 rts 



current secondary address 

Get next byte from channel 

temporary data byte 

logical index, channel# 

write, read, eoi flags, channel 

status 

current EOI status 

Get current file type 

if Z set: not a relative file 

last record flag 

Set flag 



scratch file(s), copy, rename 



page 



.71 



line addr object 



source code 



03349 


e67c 










03350 


e67c 










03351 


e67c 


==> Rename file 


in directory <== 




03352 


e67c 










03353 


e67c 


20 le dd 


rename jsr alldrs 


Set up both drives from F2CNT 


03354 


e67f 


a5 8c 




Ida fildat+1 




03355 


e681 


29 01 




and #$0l 




03356 


6683 


85 8c 




ata fildat+1 




03357 


e685 


c5 8b 




cmp fildat 


drive number, pattern 


03358 


e687 


fO 02 




beq rnlO 


same drive numbers 


03359 


e689 


09 80 




ora #$80 


check both for name 


03360 


e68b 


85 8b 


rnlO 


sta fildat 


drive number, pattern 


03361 


e68d 


20 7a de 




jar lookup 


Look up files in cmd string in 
directory & fill tables 


03362 


e690 


20 eO e6 




Jsr chkio 


Check existence of I/O file 


03363 


e693 


a5 8c 




Ida fildat+1 




03364 


e695 


29 01 




and #$01 




03365 


e697 


85 12 




sta drvnum 


current drive number 


03366 


e699 


a5 87 




Ida filent+l 




03367 


e69b 


48 




pha 




03368 


e69c 


29 If 




and #%11111 




03369 


e69e 


85 14 




sta sector 


current sector number 


03370 


e6a0 


20 59 f 9 




jsr rdab 


read directory sector 


03371 


e6a3 


20 87 ec 




jsr watjob 




03372 


e6a6 


68 




pla 




03373 


e6a7 


29 70 




and #%1 110000 


set sector index 


03374 


e6a9 


09 05 




ora #$05 


...+5 


03375 


e6ab 


20 cl fO 




jsr setpnt 


Set up pointer into active data 
buffer 


03376 


e6ae 


20 95 fa 




jsr getact 


Get active buffer number 


03377 


e6bl 


a8 




tay 




03378 


e6b2 


ae 80 43 




Idx filtbl 


table of filename pointers 


03379 


e6b5 


a9 10 




Ida #16 


number of characters in name 


03380 


e6b7 


20 69 eO 




jsr trname 


Transfer filename from command 
string to buffer 


03381 


e6ba 


20 60 f9 




jsr wrtout 


write revised sector 


03382 


e6bd 


20 87 ec 




jsr watjob 


Wait until job is completed 


03383 


e6c0 


4c 9f db 




Jmp endcmd 


Terminate command successfully 


03384 


e6c3 










03385 


e6c3 










03386 


e6c3 


==> Check 


existence of input file 


<=== 


03387 


e6c3 










03388 


e6c3 


a5 8c 


chkin 


Ida fildat+1 




03389 


e6c5 


29 Oe 




and #Z1110 




03390 


e6c7 


4a 




Isr a 




03391 


e6c8 


85 c5 




sta type 


current file type 


03392 


e6ca 


ae 7e 43 




Idx f2cnt 


file stream 2 count 


03393 


e6cd 


ca 


cklO 


dex 




03394 


e6ce 


ec 7d 43 




cpx flcnt 


file stream 1 count 


03395 


e6dl 


90 Oc 




bcc ck20 


C clear: found 


03396 


e6d3 


bd 86 43 




Ida filtrk.x 


first link/track 


03397 


e6d6 


29 7f 




and #%0111111l 


if link not 0, file 


03398 


e6d8 


dO f3 




bne cklO 


is found 



scratch file(s), copy, rename 



page ...72 



line addr object source code 



03399 
03400 
03401 
03402 
03403 
03404 
03405 
03406 
03407 
03408 
03409 
03410 
03411 
03412 
03413 
03414 
03415 
03415 
03416 



e6da 
e6dc 
e6df 
e6e0 
e6e0 
e6e0 
e6e0 
e6eO 
e6e3 
e6e6 
e6e8 
e6ea 
e6ec 
e6ef 
e6ef 
e6f0 
e6f2 
e6f3 
e6f3 



a9 62 
4c c9 db 
60 



ck20 



Ida #flntfd 
Jmp cmderr 
rts 



Command level error handling 



==> Check existence of I/O file <= 



20 c3 e6 
bd 86 43 
29 7f 
fO 05 
a9 63 
4c c9 db 



ca 
10 
60 



chkio 
ck25 



ck30 



fl 



jsr chkin 
Ida filtrk.x 
and nOllUlll 
beq ck30 
Ida #flexst 
Jmp cmderr 

dex 

bpl ck25 

rts 

.lib verdir 



Check existence of input file 
first link/track 



Command level error handling 



validate, memory, block commands 



page 



.73 



line addr object source code 



03418 

03419 

03420 

03421 

03422 

03423 

03424 

03425 

03426 

03427 

03428 

03429 

03430 

03431 

03432 

03433 

03434 

03435 

03436 

03437 

03438 

03439 

03440 

03441 

03442 

03443 

03444 

03445 

03446 

03447 

03448 

03449 

03450 

03451 

03452 

03453 

03454 

03455 

03456 

03457 

03458 

03459 

03460 

03461 

03462 
03463 
03464 
03465 
03466 
03467 
03468 
03469 



e6f3 
e6f3 
e6f3 
e6f3 
e6f6 
e6f9 
e6fc 
e6fe 
e701 
e704 
e706 
e708 
e70a 
e70c 
e70e 

6711 

e713 

e7l6 

e7l9 

e719 

e71a 

e7lc 

e7ld 

e71e 

e720 

e721 

e723 

e725 

e727 

e729 

e72a 

e72c 

e72e 

e73I 

e732 

e734 

e735 

e737 

e73a 

e73d 

e73f 

e741 

e743 

e745 

e748 
e74b 
e74b 
e74b 
e74b 
e74b 
e74e 
e751 



==> Validate files with BAM, update BAM <= 



20 d2 db 
20 ff ec 
20 73 e7 
a9 00 
8d 98 43 
20 da df 
dO 39 
a9 00 
85 14 
a9 12 
85 13 
20 4b e7 
a5 12 
20 5c f6 
4c 9f db 



27 



c8 

b1 

48 

c8 

bl 27 

48 

aO 13 

bl 27 

fO Oa 

85 13 

c8 

bl 27 

85 14 

20 4b e7 

68 

85 14 

68 

85 13 

20 4b e7 

20 31 eO 

fO c7 

aO 00 

bl 27 

30 d4 

20 45 e3 

4c 3a e7 



verdir 

valdat jsr 
Jsr 
Jsr 
Ida 
sta 
Jsr 
bne 
Ida 
sta 
Ida 
sta 
Jsr 
Ida 
Jsr 
Jmp 



vdlO 



vdl5 



vdl7 



vd20 



vd25 



simprs 

initdr 

newmpv 

#$00 

delind 

srchst 

vd25 

#$00 

sector 

#18 

track 

mrkbam 

drvnum 

molO 

endcmd 



iny 
Ida 
pha 
iny 
Ida 
pha 
Idy 
Ida 
beq 
sta 
iny 
Ida 
sta 
Jsr 
pla 
sta 
pla 
sta 
Jsr 
Jsr 
beq 
Idy 
Ida 
bmi 
jsr 



(dirbuf),y 



(dirbuf ),y 

#19 

(dirbuf ),y 
vdl7 
track 

(dirbuf ),y 

sector 

mrkbam 

sector 

track 

mrkbam 

srre 

vdIO 

#$00 

( dirbuf ),y 

vdl5 

deldir 



jmp vd20 



extract drive number 
for name, ID 
Set up new BAM 

index of first available entry 

Initiate search of directory 

found a file 

set directory sectors 

in BAM 

current track number 

Mark BAM with file sectors 

current drive number 

write out BAM 

Terminate command successfully 



save track 

save sector 

get SS track 

is this relative? 

no 

yes — save track number 

get SS sector 

validate SS by links 

now do data blocks 



set bit used in BAM 
search for more 
no more files 

directory buffer pointer 

not closed - delete the entry in the 
directory 



===> Mark BAM with file sectors <== 



20 89 d7 
20 9f eb 
20 6c fO 



mrkbam Jsr setbmp 
jsr usedts 
jsr opnlrd 



Set (indirect) BAM pointer 

mark track & sector as used 

Open internal read channel (SA»17) 



validate, memory, block commands 



page ...74 



line 


addr 


object 




source 


! code 




03470 


e754 


a9 00 




mrk2 


Ida #$00 




03471 


e756 


20 cl 


fO 




jsr 


setpnt 


Set up pointer into active data 
buffer 


03472 


e759 


20 bS 


ed 




Jsr 


getbyt 


Read one byte from the active buf: 


03473 


e75c 


85 13 






sta 


track 


current track number 


03474 


e75e 


20 bS 


ed 




jsr 


getbyt 


Read one byte from the active buf: 


03475 


e761 


85 14 






sta 


sector 


current sector number 


03476 


e763 


a5 13 






Ida 


track 


current track number 


03477 


e765 


dO 03 






bne mrkl 




03478 


e767 


4c aA 


ee 




jmp 


frechn 


Free channel associated with SA 


03479 


e76a 














03480 


e76a 


20 9f 


eb 


mrkl 


jsr 


usedts 


mark track & sector as used 


03481 


e76d 


20 44 fO 




Jsr 


nxtbuf 




03482 


e770 


4c 54 


e7 




jmp 


mrk2 




03483 


e773 














03484 


e773 














03485 


e773 


==> Set 


up new BAM <= 


E» 




03486 


e773 














03487 


e773 


20 89 d7 


newmpv 


jsr 


setbmp 


Set (indirect) BAM pointer 


03488 


e776 


aO 00 




newmap 


i Idy #$00 




03489 


e778 


a9 12 






Ida #18 


set link to track 18 sector 1 


03490 


e77a 


91 02 






sta 


(bmpnt),y 




03491 


e77c 


c8 






iny 






03492 


e77d 


98 






tya 






03493 


e77e 


91 02 






sta 


(bmpnt),y 




03494 


e780 


c8 






Iny 






03495 


e781 


c8 






Iny 






03496 


8782 


c8 






iny 




.y = 4 


03497 


e783 


a9 00 




nmlO 


Ida #$00 


clear track map 


03498 


e785 


85 04 






sta 


to 




03499 


e787 


85 05 






sta 


tl 




03500 


8789 


85 06 






sta 


t2 




03501 


e78b 


98 






tya 






03502 


e78c 


4a 






Isr 


a 




03503 


878d 


4a 






lar 


a 


•A = track number 


03504 


e78e 


20 db 


d7 




jsr 


maxsec 


Tell how many sectors allowed for 
this track 


03505 


e791 


91 02 






sta 


(bmpnt),y 


bit map pointer 


03506 


8793 


c8 






iny 






03507 


e794 


aa 






tax 






03508 


e795 


38 




nm20 


sec 




set map bits 


03509 


e796 


26 04 






rol 


to 




03510 


e798 


26 05 






rol 


tl 




03511 


e79a 


26 06 






rol 


t2 




03512 


e79c 


ca 






dex 






03513 


e79d 


dO f6 






bne 


nm20 




03514 


e79f 














03515 


e79f 


b5 04 




nm30 


Ida 


temp,x 


.X=0 


03516 


e7al 


91 02 






sta 


(bmpnt),y 


bit map pointer 


03517 


e7a3 


c8 






iny 






03518 


e7a4 


e8 






inx 






03519 


e7a5 


eO 03 






cpx 


#$03 




03520 


e7a7 


90 f6 






bcc 


nm30 





validate, meinory, block commands 



page ...76 



line addr object source code 



03573 

03574 

03575 

03576 

03577 

03578 

03579 

03580 

03581 

03582 

03583 

03584 

03585 

03586 

03587 

03588 

03589 

03590 

03591 

03592 

03593 

03594 

03595 

03596 

03597 

03598 

03599 

03600 

03601 

03602 

03603 

03604 

03605 

03606 

03607 

03608 

03609 

03610 

03611 

03612 

03613 

03614 

03615 

03616 

03617 

03618 

03619 

03620 

03621 

03622 

03623 

03624 

03625 



e7fl 

e7f3 

e7f5 

e7f8 

e7f8 

e7fb 

e7fe 

e7fe 

eSOO 

e803 

e803 

e806 

e808 

e809 

eSOc 

eSOe 

e80f 

e80f 

eSOf 

e80f 

e80f 

e8l2 

e8U 

e8l6 

e8l8 

e8la 

e81c 

eSle 

e81f 

e8lf 

e822 

e825 

e825 

e826 

e827 

e829 

e82a 

e82b 

e82d 

e82f 

e830 

e832 

e834 

e837 

e837 

e837 

e837 

e837 

e83a 

e83b 

e83d 

e83f 

e842 



a5 05 
85 48 
4c 3b fO 

20 6e ed 
4c 32 fO 

a9 31 
4c c9 db 

b9 06 43 

91 04 

c8 

cc 05 43 

90 f5 

60 



ai30 



Ida tl 
sta cb+3 
Jmp ge20 

jar fndrch 
jmp gel 5 



meoerr Ida #badcmd 
jmp cmderr 

menwrt Ida cmdbuf+6,y 
sta (temp),y 
Iny 

cpy cmdbuf-<-5 
bcc memwrt 
rts 



=> User Jump commands <» 



43 



ac 01 
cO 30 
dO 09 
a9 ea 
85 00 
a9 ff 
85 01 
60 



20 25 e8 
4c 9f db 

88 

98 

29 Of 

Oa 

a8 

bl 00 

85 Oa 

c8 

bl 00 

85 Ob 

6c Oa 00 



user Idy cmdbuf+l 
cpy #'0' 
bne usIO 

usrlnt Ida #<ublock 
sta usrjmp 
Ida #>ublock 
sta usrjmp+l 
rts 

ustO jsr usrexc 
Jmp endcmd 



hi byte 

continue read 

Find the assigned read channel 
terminate read 



transfer from cmdbuf 
number of bytes to write 



UO restores pointer to JMP table 



resets pointer 

restores normal address ($FFEA) 

USR-vector 



execute code by table 
Terminate command successfully 



entry is (((index-l)AND$F)*2) 
convert to hex 



usrexc dey 
tya 

and #$0f 
asl a 
tay 

Ida (usrjmp),y USR-vector 
sta ip Indirect pointer variable 
iny 

Ida (usrjmp),y USR-vector 
sta lp+1 
jmp (Ip) indirect pointer variable 



=> Open direct access buffer ("#") <» 



ae 79 43 
ca 

dO Od 
a9 01 
20 63 ee 
4c 8e e8 



opnblk Idx cmdslz 
dex 

bne oblO 
Ida #$01 
jsr getrch 
jmp ob30 



command string size 



get any buffer 

Open a new read channel 



validate, memory, block commands 



page 



.75 



line addr object 



03521 
03522 
03523 
03524 
03525 
03526 
03527 
03528 
03529 
03530 
03531 
03532 
03533 
03534 
03535 
03536 
03537 
03538 
03539 
03540 
03541 
03542 
03543 
03544 
03545 
03546 
03547 
03548 
03549 
03550 



e7a9 
e7ab 
e7ad 
e7ae 
e7ae 
e7af 
e7af 
e7af 
e7af 
e7a£ 
e7b2 
e7b4 
e7b6 
e7b9 
e7bb 
e7be 
e7c0 
e7c2 
e7c5 
e7c7 
e7c9 
e7cb 
e7cd 
e7cf 
e7dl 
e7d4 
e7d4 
e7d6 
e7d8 
e7db 



cO 90 
90 d6 
60 

47 



source code 

cpy #$90 
bcc nmlO 
rts 

echksm .byte $47 



end of BAM 



checksum E-ROM 



===> Memory access cmds: M-R, M-W, M-E <= 



ad 01 43 
c9 2d 
dO 48 
ad 03 43 
85 04 
ad 04 43 
85 05 
aO 00 
ad 02 43 
c9 57 
fO 3a 
c9 52 
fO 07 
c9 45 
dO 2d 
6c 04 00 



bl 04 
85 18 
ad 79 43 
c9 06 



memrd 



Ida cmdbuf+1 




cmp #•-• 


must be second character 


bne memerr 




Ida cradbuf+3 


set address in temp 


sta temp 




Ida cmdbuf+4 




sta tl 




Idy #$00 




Ida cmdbuf+2 


third character 


cmp #'w' 


M-W 


beq memwrt 




cmp #'r' 


M-R 


beq memrd 




cmp #'e' 


M-E 


bne memerr 




Jmp (temp) 




Ida (temp),y 




sta data 




Ida cmdsiz 


command string size 


cmp #$06 





03552 
03553 
03554 
03555 
03556 
03557 
03558 
03559 
03560 
03561 
03562 
03563 
03564 
03565 
03566 
03567 
03568 



e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7dd 
e7df 
e7e2 
e7e3 
e7e5 
e7e6 
e7e7 



03569 e7e9 

03570 e7eb 

03571 e7ed 

03572 e7ef 



Commodore documentation implies that only one byte can be read 
by M-R, as in PRINT#l5,"M-R";chr$(lo);chr$(hi). This results in 
a command length of five bytes. However, the cmp is for six 
bytes. Tests have shown that the sixth byte may hold the number 
of reads — up to 255 — to be carried out, as in 

PRINT#15,"M-R";chr$(lo);chr$(hi);chr$(number of bytes) 



90 19 

ae 05 43 

ca 

fO 13 

8a 

18 

65 04 

e6 04 
85 c4 
a5 04 
85 47 



bcc m30 

Idx cmdbuf+5 

dex 

beq m30 

txa 

clc 

adc temp 



inc temp 

sta Istchr+errchn 

Ida temp lo byte 

sta cb+2 



sixth character 

now $00 if only one to read 



add lo byte of last character to be 

sent 

to point to second memory location 



validate, memory, block commands 



page ...77 



line 


addr 


object 


source code 


03626 


e845 








03627 


e845 


a9 70 


ob05 


Ida #nochnl 


03628 


8847 


4c c9 db 




jmp cmderr 


03629 


e84a 








03630 


e84a 


aO 01 


oblO 


Idy #$01 


03631 


e84c 


20 17 e9 




Jsr bp05 


03632 


e84f 


ae 8b 43 




Idx filsec 


03633 


e852 


eO Oc 




cpx #bamjob 


03634 


e854 


bO ef 




bcs ob05 


03635 


e856 


a9 00 




Ida #$00 


03636 


e858 


85 04 




sta temp 


03637 


e85a 


85 05 




sta tl 


03638 


e85c 


38 




sec 


03639 


e85d 


26 04 


obi 5 


rol temp 



03640 e85f 26 05 

03641 e86l ca 

03642 e862 10 f9 



03643 


e864 


a5 04 


03644 


e866 


2d 3e 43 


03645 


e869 


dO da 


03646 


e86b 


a5 05 


03647 


e86d 


2d 3f 43 


03648 


e870 


dO d3 


03649 


e872 


a5 04 


03650 


e874 


Od 3e 43 


03651 


e877 


8d 3e 43 


03652 


e87a 


a5 05 


03653 


e87c 


Od 3f 43 


03654 


e87f 


8d 3f 43 


03655 


e882 


a9 00 


03656 


e884 


20 63 ee 


03657 


e887 


a6 15 


03658 


e889 


ad 8b 43 


03659 


e88c 


95 49 


03660 


e88e 


a6 16 


03661 


e890 


b5 a2 


03662 


6892 


09 40 


03663 


e894 


95 a2 


03664 


e896 


a4 15 


03665 


e898 


a9 ff 


03666 


e89a 


99 bd 00 


03667 


e89d 


a9 89 


03668 


e89f 


99 98 00 


03669 


e8a2 


b9 49 00 


03670 


e8a5 


99 b5 00 


03671 


e8a8 


Oa 


03672 


e8a9 


aa 


03673 


e8aa 


a9 01 



ob30 



rol tl 



dex 



bpl obl5 



Ida 


temp 


and 


bufuse 


bne ob05 


Ida 


tl 


and 


bufuse+l 


bne ob05 


Ida 


temp 


ora 


bufuse 


sta 


bufuse 


Ida 


tt 


ora 


bufuse+l 


sta 


bufuse+l 


Ida 


#$00 


jsr 


getrch 


Idx 


lindx 


Ida 


filsec 


sta 


bufO.x 


Idx 


sa 


Ida 


llntab,x 


ora 


#$40 


sta 


lintab.x 


Idy 


lindx 


Ida 


#$ff 


sta 


Istchr.y 


Ida 


#rndrdy 


sta 


chnrdy.y 


Ida 


bufO,y 


sta 
ssi. 


chndat.y 
a 


tax 


Ida 


#$01 



no channel error 



buffer number requested 

buffer number 

must be less than 13 



loop to shift a 1 to position 
according to buf 

e.g. Tl (00000000) THMP (00000001) 
buffer 

Tl (00000000) TEMP (OOOOOIOO) 
buffer 2 

Tl (OOOOOOOl) TEMP (00000000) 
buffer 8 

indicate buffer in use 

buffer in use 

find out which 

Is in use 

if not 0, abort 

mark buffer used 



set up channel 

Open a new read channel 

logical index, channel number 

first link/sector 

channel buffer table I 

current secondary address 

set LINDX table 

read/write mode 

current status SA 

logical index, channel number 

last character pointer 

channel last character pointer 

ready for random access flag 

write, read, eoi flags, channel 

status 

channel buffer table I 

buffer number as first character 



validate, memory, block commands 



page 



.78 



line addr object 



source code 



03674 

03675 

03676 

03677 

03678 

03679 

03680 

03681 

03682 

03683 

03684 

03685 

03686 

03687 

03688 

03689 

03690 

03691 

03692 

03693 

03694 

03695 

03696 

03697 

03698 

03699 

03700 

03701 

03702 

03703 

03704 

03705 

03706 

03707 

03708 

03709 

03710 

03711 

03712 

03713 

03714 

03715 

03716 

03717 

03718 

03719 

03720 

03721 

03722 

03723 

03724 

03725 

03726 



e8ac 

e8ae 

eSbO 

e8b3 

e8b6 

e8b6 

e8b6 

e8b6 

e8b6 

e8b8 

e8ba 

e8bc 

eSbf 

e8cl 

e8c3 

e8c6 

e8c6 

e8c8 

e8cb 

eScb 

e8cc 

e8ce 

e8d0 

e8d3 

e8d6 

eSdS 

e8d9 

e8db 

e8dd 

e8de 

eSeO 

e8e3 

e8e6 

e8e9 

e8ea 

eSeb 

eSee 

e8fO 

e8£3 

e8f5 

e8f8 

e8f8 

e8f8 

e8f8 

e8f8 

e8fb 

e8fe 

eSfe 

eSfe 

eSfe 

e900 

e902 

e904 



95 29 
a9 Oe 
99 90 00 
4c 9f db 



sta buftab.x buffer pointer lo 

Ida #dirtyp+dirtyp 

sta filtyp.y set direct access file type 

jmp endcmd Terminate command successfully 



==> Block comfflands: B-A, B-F, B-R, B-W, B-E, B-P <== 



aO 00 
a2 00 
a9 2d 
20 69 dc 
dO Oa 
a9 31 
4c c9 db 



a9 30 
4c c9 



block 



blklO 



blkSO 



db 



Idy #$00 
Idx #$00 
Ida #'-' 
jsr parse 
bne blk40 
Ida #badcmd 
Jmp cmderr 

Ida #badsyn 
Jmp cmderr 



8a 

dO fS 
a2 05 
b9 00 43 
dd f8 e8 
fO 05 
ca 

to f8 
30 e4 
8a 

09 80 
8d 7a 43 
20 Oa e9 
ad 7a 43 
Oa 
aa 

bd ff e8 
85 05 
bd fe e8 
85 04 
6c 04 00 



blk40 txa 
bne 
Idx 
Ida 

blkSO cmp 
beq 
dex 
bpl 
bmi 

blk60 txa 
ora 
sta 
jsr 
Ida 
asl 
tax 
Ida 
sta 
Ida 
sta 
jmp 



blk30 
#nbcmds-l 
cmdbuf ,y 
be tab, x 
blk60 

blk50 
blklO 

#$80 
cmdnum 
blkpar 
cmdnum 



bcjmp+l,x 

tl 

be jmp, X 

temp 

(temp) 



==> Block sub-command table <== 

41 46 52 bctab .byte 'afrwep' 
57 45 50 

nbcmds = *-bctab 

99 e9 be Jmp .word blkalc 

90 e9 .word blkfre 

fc e9 .word blkrd 

19 ea .word blkwt 



separates from subcommand 
locate subcommand 



Command level error handling 
Command level error handling 

find command 

Block sub-command table 



command# 

Parse the block parameters 

command# 



block-allocate 
block-free 
block-read 
block-write 



validate, memory, block commands 



page 



.79 



line addr object source code 



03727 

03728 

03729 

03730 

03731 

03732 

03733 

03734 

03735 

03736 

03737 

03738 

03739 

03740 

03741 

03742 

03743 

03744 

03745 

03746 

03747 

03748 

03749 

03750 

03751 

03752 
03753 
03754 
03755 
03756 
03757 
03758 
03759 
03760 
03761 
03762 
03763 
03764 
03765 
03766 
03767 
03768 
03769 
03770 
03771 
03772 
03773 
03774 
03775 
03776 
03777 
03778 



e906 
e908 
e90a 
e90a 
e90a 
e90a 
e90a 
e90c 
e90e 
e9T0 
e913 
e9l5 
e917 
e91a 
e9lc 
e91e 
e920 
e922 
e924 
e926 
e927 
e92a 
e92c 
e92d 
e92d 

e930 
e933 
e936 
e938 
e93a 
e93c 
e93c 
e93c 
e93c 
e93c 
e93e 
e940 
e942 
e944 
e946 
e949 
e94b 
e94d 
e94f 
e951 
e953 
e954 
e956 
e958 
e95a 
e95c 
e95d 



49 ea 
60 ea 



.word blkexc 
.word blkptr 



aO 00 
a2 00 
a9 3a 
20 69 dc 
dO 02 
aO 03 
b9 00 43 
c9 20 
fO 08 
c9 Id 
fO 04 
c9 2c 
dO 07 
c8 

cc 79 43 
90 eb 
60 



bp05 



blkpar Idy 
Idx 
Ida 
jsr 
bne 
Idy 
Ida 
cmp 
beq 
cmp 
beq 
cmp 
bne 
iny 
cpy 
bcc 
rts 



bplO 



#$00 

#$00 

#•:' 

parse 

bp05 

#$03 

cmdbuf ,y 

#$20 

bplO 

#29 

bplO 

bp20 

cmdslz 
bp05 



20 3c e9 bp20 jsr aschex 



ee 7d 43 
ac It 43 
eO 04 
90 ec 
bO 8a 



inc flcnt 
Idy f2ptr 
cpx #$04 
bcc bplO 
bcs blk30 



block execute 
block-pointer 



==> Parse the block parameters <=== 



Store desired character in CHAR 
found : 

else character 3 is beginning 
cotnmand buffer 



skip character 



command string size 

That's all, folks I 

Convert ASCII to hex & store 
conversion in tables 
file stream 1 count 
file stream 2 pointer 



===> Convert ASCII to hex & store conversion in tables <=== 



a9 00 
85 04 
85 05 
85 07 
a2 ff 
b9 00 43 
c9 40 
bO 18 
c9 30 
90 14 
29 Of 
48 

a5 05 
85 06 
a5 04 
85 05 
68 
85 04 



aschex Ida 
sta 
sta 
sta 
Idx 

ahlO Ida 
cmp 
bcs 
cmp 
bcc 
and 
pha 
Ida 
sta 
Ida 
sta 
pla 
sta 



#$00 

temp 

tl 

t3 

#$ff 

cmdbuf ,y 

#$40 

ah20 

#$30 

ah20 

#$0f 

tl 
t2 

temp 
tl 

temp 



temporary work area 



command string byte 

numeric? 

non-mumeric terminates 

ASCII? 

mask off hi bits 



validate, memory, block commands 



page 



.80 



line addr object 



source code 



03779 e95f 

03780 e960 

03781 e963 

03782 e965 



03783 
03784 
03785 
03786 
03787 
03788 
03789 
03790 
03791 
03792 
03793 
03794 
03795 
03796 
03797 
03798 
03799 
03800 
03801 
03802 
03803 
03804 
03805 
03806 
03807 
03808 
03809 
03810 
03811 
03812 
03813 
03814 
03815 
03816 
03817 
03818 
03819 
03820 
03821 
03822 
03823 
03824 
03825 
03826 
03827 
03828 
03829 
03830 



e968 
e969 
e96b 
e96c 
e96e 
e970 
e972 
6973 
e975 
e978 
e97a 
e97b 
e97d 
e97f 
e980 
e983 
e985 
e988 
e989 
e98c 
e98d 
e98d 
e98d 
e98d 
e98d 
e990 
e990 
e990 
8990 
e990 
8993 
e996 
e999 
e999 
8999 
e999 
e99c 
e99e 
e9al 
e9a3 
e9a6 
89a9 
e9ab 
e9ad 
e9ae 
e9b0 
e9b3 
e9b5 



c8 

cc 79 43 

90 el 

8c 7f 43 ah20 



18 

a9 00 

e8 

eO 03 

bO Of 

b4 04 

88 

30 f6 

7d 8d e9 

90 f8 

18 

e6 07 

dO f3 

48 

ae 7d 43 

a5 07 

9d 86 43 

68 

9d 8b 43 

60 



ah30 



ah35 



ah40 



iny 

cpy cmdslz 
bcc ah 10 
sty f2ptr 

cXc 

Ida #$00 

Inx 

cpx #$03 

bcs ah40 

Idy temp,x 

dey 

bml ah30 

adc dectab.x 

bcc ah35 

clc 

Inc t3 

bne ah35 

pha 

Idx flcnt 

Ida t3 

sta flltrk,x 

pla 

sta fllsec.x 

rts 



If more commands left 

convert digits to binary by decimal 
table 



are we done? 
yes 



Decimal conversion table 



•A = hex number 
command segment counter 
carry bit (thousands) 
store result In table 



==> Decimal conversion table <=== 
01 Oa 64 dectab .byte 1, 10, 100 

==> B-F de-allocate (free) a block in the BAM <= 



20 98 ea blkfre jsr blktst 
20 Ic da Jsr frets 
4c 9f db Jmp endcmd 



test for legal block 
Free track/sector In BAM 
Terminate command successfully 



=> B-A to allocate block in the BAM <= 



20 98 ea blkalc jsr blktst 
a6 12 Idx drvnum 

bd eS d2 Ida ipbm.x 

85 03 sta bmpnt+l 
20 95 d7 balO Jsr avail 
20 bl d7 ba20 Jsr av2 

bO 26 bcs ba40 

a6 14 Idx sector 

e8 inx 

86 14 stx sector 
8e 73 43 stx erword 
e4 19 cpx rO 

90 ef bcc ba20 



test for legal block 
current drive number 
BAM address hi 

Check BAM for available sector 

search for next available sector 



current sector number 
set not available flag 



validate, memory, block commands 



page ...81 



line addr object source code 



03831 

03832 

03833 

03834 

03835 

03836 

03837 

03838 

03839 

03840 

03841 

03842 

03843 

03844 

03845 

03846 

03847 

03848 

03849 

03850 

03851 

03852 

03853 

03854 

03855 

03856 

03857 

03858 

03859 

03860 

03861 

03862 

03863 

03864 

03865 

03866 

03867 

03868 



e9b7 
e9b9 
e9bb 
e9bd 
e9be 
e9cO 
e9c2 
e9c4 
e9c7 
e9ca 
e9ca 
e9cc 
e9ce 
e9d1 
e9dl 
e9d4 
e9d6 
e9d9 
e9dc 
e9dc 
e9dc 
e9dc 
e9dc 
e9df 
e9e2 
e9e2 
e9e2 
e9e2 
e9e2 
e9e5 
e9e7 
e9e8 
e9e8 
e9e8 
e9e8 
e9e8 
e9eb 
e9ed 



a9 00 

85 14 
a6 13 
e8 

86 13 
eO 24 
bO 06 

20 ab ea 
4c a3 e9 

85 13 
a9 65 
4c 5c d9 

ae 73 43 
dO f6 
20 9f eb 
4c 9f db 



Ida #$00 
sta sector 
Idx track 
Inx 

stx track 
cpx #36 
bos ba30 
Jsr bt05 
jmp balO 

ba30 sta track 
ba35 Ida #noblk 
Jfflp cmder2 

ba40 Idx erword 
bne ba35 
jsr usedts 
jmp endcmd 



current track number 



track unavailable 



track not available: 



search finished 

block wasn't available 

mark track & sector as used 

Terminate command successfully 



===> B-R sub to test parameters <== 



20 95 ea 
4c 57 £0 



blkrd2 jsr bkotst 
jmp drtrd 



Test all block operation parameters 
Direct block read 



==> B-R sub to get byte without Increment <= 



20 bO ed getsim jsr getpre 

al 29 Ida (buftab.x) 

60 rts 



===> B-R sub to do read <== 
20 dc e9 blkrd3 jsr blkrd2 



a9 00 
20 cl fO 



03869 e9fO 20 e2 e9 



03870 
03871 
03872 

03873 
03874 
03875 
03876 
03877 
03878 
03879 
03880 



e9f3 
e9f6 
e9f8 

e9fb 
e9fc 
e9fc 
e9fc 
e9fc 
e9fc 
e9ff 
ea02 



99 bd 00 
a9 89 
99 98 00 

60 



Ida #$00 
jsr setpnt 

jsr getsim 

sta lstchr,y 
Ida #rndrdy 
sta chnrdy,/ 

rts 



===> Block read a sector <= 

20 e8 e9 blkrd jsr blkrd3 
20 e5 ef jsr rngetl 
4c 9f db jmp endcmd 



get byte without increment 
buffer pointer lo 



B-R sub to test parameters 

Set up pointer Into active data 

buffer 

B-R sub to get byte without 

increment 

channel last character pointer 

for random access ready 

write, read, eoi flags, channel 

status 



B-R sub to do read 
read in the sector 
Terminate command successfully 



validate, memory, block commands 



page 



.82 



line addr object 



source code 



03881 
03882 
03883 
03884 
03885 
03886 
03887 
03888 
03889 
03890 
03891 
03892 
03893 
03894 
03895 
03896 
03897 
03898 
03899 
03900 
03901 
03902 
03903 
03904 
03905 
03906 
03907 
03908 

03909 
03910 

03911 
03912 
03913 
03914 
03915 
03916 

03917 
03918 
03919 
03920 
03921 
03922 
03923 
03924 
03925 
03926 
03927 



ea05 
ea05 
ea05 
ea05 
ea05 
ea05 
ea05 
ea05 
ea05 
ea08 
eaOb 
eaOe 
eall 
e8l3 
ea16 
ea19 
ea19 
ea19 
ea19 
eal9 
ealc 
ealf 
ea20 
ea21 
ea23 
ea25 
ea27 
ea29 

ea2c 
ea2d 

ea30 
ea31 
ea32 
ea35 
ea36 
ea37 

ea3a 
ea3d 
ea3d 
ea3d 
ea3d 
ea40 
ea43 
ea46 
ea49 
ea49 
ea49 



==> U1 - block read a sector (preferred alternative) <== 

The only real difference with a B-R command Is that U1 moves 
the last byte into the data buffer and stores $FF as 
the last byte read 



20 Oa e9 ublkrd jsr blkpar 

20 e8 e9 jsr blkrdS 

b9 bd 00 Ida Istchr.y 

99 b5 00 sta chndat,y 

a9 ff Ida #$ff 

99 bd 00 sta lstchr,y 

4c 9f db jmp endcmd 



=> Block write of a sector <= 



20 95 ea 
20 el fO 
a8 
88 

c9 02 
bO 02 
aO 01 
a9 00 
20 cl fO 

98 

20 b6 ec 

8a 

48 

20 5b fO 

68 

aa 

20 e7 ef 

4c 9f db 



blkwt 



bwlO 



bw20 



jsr bkotst 

jsr getpnt 

tay 

dey 

cmp #$02 

bcs bwlO 

Idy #$01 

Ida #$00 

jsr setpnt 

tya 

jar putbyt 

txa 

pha 

jsr drtwrt 

pla 

tax 

jsr rnget2 

jmp endcmd 



Parse the block parameters 

B-R sub to do read 

channel last character pointer 

channel data byte 

last character 

channel last character pointer 

Terminate command successfully 



Test all block operation parameters 
Get the active buffer pointer 



Set up pointer into active data 
buffer 

Byte to active buffer of LINDEX 
channel 



Direct block write 



set channel ready status and last 

character 

Terminate command successfully 



=> U2 - block write of a sector <== 



20 Oa e9 
20 95 ea 
20 5b fO 
4c 9f db 



ublkwt jsr blkpar 
jsr bkotst 
jsr drtwrt 
jmp endcmd 



Parse the block parameters 

Test all block operation parameters 

Direct block write 

Terminate conmiand successfully 



validate, memory, block commands 



page 



.83 



line addr object source code 



03928 
03929 
03930 
03931 
03932 
03933 
03934 

03935 

03936 

03937 

03938 

03939 

03940 

0394T 

03942 

03943 

03944 

03945 

03946 

03947 

03948 

03949 

03950 

0395T 

03952 

03953 

03954 

03955 

03956 

03957 

03958 

03959 

03960 

03961 

03962 

03963 

03964 

03965 

03966 

03967 

03968 

03969 

03970 

03971 

03972 

03973 

03974 

03975 

03976 



ea49 
ea49 
ea49 
ea4c 
ea4e 
ea50 
ea52 

ea55 

ea57 

ea5a 

ea5d 

ea5d 

ea60 

ea60 

ea60 

ea60 

ea60 

ea63 

ea65 

ea66 

ea67 

ea6a 

ea6c 

ea6£ 

ea72 

ea75 

ea75 

ea75 

ea75 

ea75 

ea77 

ea79 

ea7c 

ea7d 

ea7e 

ea7f 

ea81 

ea83 

ea85 

ea88 

ea88 

ea8a 

eaSd 

ea8f 

ea92 

ea94 

ea95 

ea95 

ea95 



===> Block execute a sector <= 

20 dc e9 blkexc jsr blkrd2 
a9 00 Ida #$00 

85 04 be05 sta temp 
a6 al Idx Jobnum 

bd ff fO Ida bufind.x 

85 05 sta t1 

20 5d ea jsr belO 
4c 9f db jmp endcmd 

6c 04 00 belO jmp (temp) 



B-R sub to test parameters 

lo byte of 

JMP address 

current job number 

hi byte table of pointers to data 

buffer 



Terminate command successfully 
temporary work area 



===> B-P - Set the buffer pointer <= 



ea 



20 75 

a5 al 

Oa 

aa 

ad 8c 43 

95 29 

20 bO ed 

20 e7 ef 

4c 9f db 



blkptr jsr buftst 
Ida Jobnum 
asl a 
tax 

Ida filsec+1 
sta buftab,x 
jsr getpre 
jsr rnget2 
jmp endcmd 



Test whether a buffer is allocated 
buffer number 



buffer pointer lo 
Set buffer pointers 

Terminate command successfully 



==> Test whether a buffer is allocated related to SA <= 



a6 81 

e6 81 

bd 8b 43 

a8 

88 

88 

cO Oc 

90 05 

a9 70 

4c c9 db 

85 16 
20 6e ed 
bO f4 
20 95 fa 
85 al 
60 



buftst Idx flptr 
inc flptr 
Ida filsec.x 
tay 
dey 
dey 

cpy #bamjob 
bcc bt20 

btl5 Ida #nochnl 
jmp cmderr 



bt20 



sta sa 
jsr fndrch 
bcs btl5 
jsr getact 
sta jobnum 
rts 



file stream 1 pointer 
first link/sector 



eliminate reserved SA and 1 
test passes if SA 2-14 



Command level error handling 

current secondary address 
Find the assigned read channel 

Get active buffer number 
buffer number 



validate, mefflory, block commands 



page 



.84 



line addr object 



source code 



03977 
03978 
03979 
03980 

03981 
03982 
03983 
03984 
03985 
03986 
03987 
03988 
03989 

03990 
03991 
03992 
03993 
03994 
03995 
03996 
03997 
03998 
03999 
04000 
04001 
04002 
04003 
04004 
04005 
04006 
04007 
04008 
04009 
04010 
040U 
04012 
04013 
04014 
04015 
04016 
04017 
04018 
04019 
04020 
04021 
04022 
04023 
04024 
04025 
04026 
04027 



ea95 
ea95 
ea95 
ea98 

ea9a 
ea9d 
ea9f 
eaal 
eaa4 
eaa6 
eaa9 
eaab 
eaab 

eaae 
eabO 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab3 
eab6 
eab9 
eabb 
eabd 
eacO 
eac2 
eac4 
eac6 
eac8 
eaca 
eacb 
eacc 
eace 
eadO 
eadi 
eadl 
eadl 
eadl 
eadl 
eadl 
ead4 
ead6 
eadS 



=3> Test all block operation parameters <= 



20 75 ea bkotst Jsr buftst 

a6 81 blktst Idx flptr 

bd 8b 43 Ida fllsec.x 

29 01 and #$01 

85 12 sta drvnum 

bd 8d 43 Ida fllsec+2,x 

85 14 sta sector 

bd 8c 43 Ida fllsec-l-l,x 

85 13 sta track 

20 6e fl bt05 jsr tschk 



85 19 
4c 35 da 



sta rO 
Jmp setlds 



Test whether a buffer Is allocated 
test for legal block, set up dr, tr 
& se 

mask off default drive bit 
current drive number 

current sector number 

current track number 

Check for bad track and sector 

values 

temporary result 

Turn on LED for current drive 



==> Find relative file <= 



Version 2.5 



inputs: 


outputs: 




RECL - record* lo 


SSNUM - 


side sector number 


RECH - record* hi 


SSIND - 


index into SS 


RS - record size 


RELPTR - 


pointer Into sector 


RECPTR - first byte wanted 


from record 





20 dl ea fndrel jsr mulply 

20 13 eb jsr dlv254 

a5 23 Ida accum+1 

85 85 sta relptr 

20 16 eb jsr dlvl20 

e6 85 inc relptr 

e6 85 inc relptr 

a5 le Ida result 

85 83 sta ssnum 

a5 23 Ida accum+1 

Oa asl a 

18 clc 

69 10 adc #16 

85 84 sta ssind 

60 rts 



result=RN*RS+RP 
Divide-by-254 entry point 
save remainder 
relative file pointer to track 

bypass two link bytes 

save quotient 
side sector number 
save remainder 
calculate index into SS 

skip link table 

(end) pointer in side sector 



=> Calculate a record's location in bytes <= 
result » RECNUM*RS+RECPTR destroys .A and 



20 7e eb mulply jsr zerres 
85 25 sta accum+3 

a6 15 Idx llndx 

b5 59 Ida recl.x 



Zero RESULT 

.A=0 

get index 

move lo byte of record* 



validate, memory, block commands 



page ...85 



line 


addr 


object 


source code 




04028 


eada 


85 


23 




sta accum+l 




04029 


eadc 


b5 


61 




Ida rech,x 


move hi 


04030 


eade 


85 


24 




sta accum4-2 




04031 


eaeO 


dO 


04 




bne mul25 


if not 


04032 


eae2 


a5 


23 




Ida accumH-l 




04033 


eae4 


fO Ob 




beq ISU150 


if =0, adjust for record#0, first 














record 


04034 


eae6 


a5 


23 


mul25 


Ida accunH-l 




04035 


eaeS 


38 






sec 




04036 


eae9 


e9 01 




sbc #$01 




04037 


eaeb 


85 


23 




sta accumfl 




04038 


eaed 


bO 02 




bcs mul50 


if carry still set 


04039 


eaef 


c6 


24 




dec accugH-2 




04040 


eafl 


b5 


71 


mul50 


Ida rs,x 


copy to temp 


04041 


eaf3 


85 


04 




sta temp 




04042 


eaf5 


46 04 


mull 00 


1 Isr temp 


do an addition? 


04043 


eaf7 


90 03 




bcc mul200 


if carry clear, no add this time 


04044 


eaf9 


20 92 eb 




jsr addres 


Add ACCUM to RESULT 


04045 


eafc 


20 


8a eb 


mul200 


jsr accx2 


Multiply ACCUM by 2 


04046 


eaff 


a5 


04 




Ida temp 


done? 


04047 


ebOl 


dO 


f2 




bne mull 00 


no 


04048 


eb03 


a5 


82 




Ida recptr 


pointer to start of record, add in 
last bit 


04049 


eb05 


18 






clc 




04050 


eb06 


65 


le 




adc result 


add byte pointer 


04051 


eb08 


85 


1e 




sta result 




04052 


ebOa 


90 06 




bcc mul400 


skip no carry 


04053 


ebOc 


e6 


If 




inc result+l 




04054 


ebOe 


dO 02 




bne mul400 




04055 


eblO 


e5 


20 




inc re3ult+2 




04056 


ebl2 


60 




mul400 


rts 




04057 


ebl3 












04058 


ebl3 












04059 


ebl3 


=== 


=> Divide-by-254 entry point <= 


==: 


04060 


ebl3 




RESULT = quotient, ACCUMtl = 


remainder. Destroys A, X 


04061 


ebl3 












04062 


ebl3 


a9 


fe 


div254 Ida #254 


divide by 254 


04063 


ebl5 


2c 






.byte $2c 




04064 


eb16 


a9 


78 


divl20 Ida #120 


divide by 120 


04065 


ebl8 


85 


04 




sta temp 


save divisor 


04066 


ebla 


a2 


03 




Idx #$03 


swap ACCUM+1,2,3 with RESULT, 1,2 


04067 


eblc 


b5 


22 


divlOO 


Ida accuffl,x 




04068 


eble 


48 






pha 




04069 


ebTf 


b5 


Id 




Ida r4,x 




04070 


eb21 


95 


22 




sta accum,x 




04071 


eb23 


68 






pla 




04072 


eb24 


95 


Id 




sta r4,x 




04073 


eb26 


ca 






dex 




04074 


eb27 


dO 


f3 




bne divlOO 




04075 


eb29 


20 


7e eb 




jsr zerres 


RESULT = 


04076 


eb2c 


a2 


00 


divl50 


Idx #$00 




04077 


eb2e 


b5 


23 


div200 


Ida accuiiH-l,x 


divide by 256 


04078 


eb30 


95 


22 




sta accum,x 


accumulator 



validate, fflemory, block commands 



page ...86 



line 


addr 


object 




source 


code 




04079 


eb32 


e8 






inx 






04080 


eb33 


eO 04 






cpx 


#$04 


done? 


04081 


eb35 


90 f7 






bcc 


div200 


no 


04082 


eb37 


a9 00 






Ida 


#$00 


zero hi byte 


04083 


eb39 


85 25 






sta 


accuiiH-3 




04084 


eb3b 


24 04 






bit 


temp 


A DIV120? 


04085 


eb3d 


30 09 






bmi 


div300 


no 


04086 


eb3f 


06 22 






asl 


accuffl 


only divide by 128 


04087 


eb41 


08 






php 




set carry 


04088 


eb42 


46 22 






Isr 


accum 


normalize 


04089 


eb44 


28 






pip 




restore carry 


04090 


eb45 


20 8b 


eb 




jar 


acc200 


2*(X/256)=X/128 


04091 


eb48 


20 92 


eb 


div300 


jsr 


addres 


total A quotient 


04092 


eb4b 


20 8a 


eb 




jar 


accx2 


A=i2*A 


04093 


eb4e 


24 04 






bit 


temp 


A DIV120? 


04094 


eb50 


30 03 






bmi 


div400 


no 


04095 


eb52 


20 87 


eb 




Jsr 


accx4 


A=4*(2*A)=8*A 


04096 


eb55 


a5 22 




div400 Ida 


accum 


add in remainder 


04097 


eb57 


18 






clc 






04098 


eb58 


65 23 






adc acciuH-l 




04099 


eb5a 


85 23 






sta 


accum-t-l 




04100 


eb5c 


90 06 






bcc 


divSOO 




04101 


ebSe 


e6 24 






inc accum+2 




04102 


eb60 


dO 02 






bne 


div500 




04103 


eb62 


e6 25 






inc accum+3 




04104 


eb64 


a5 25 




div500 


Ida accuiiH-3 


test < 256 


04105 


eb66 


05 24 






ora 


accxm+l 




04106 


eb68 


dO c2 






bne 


divl50 


crunch some more 


04107 


eb6a 


a5 23 






Ida accum+1 


is remainder < divisor? 


04108 


eb6c 


38 






sec 






04109 


eb6d 


85 04 






sbc 


temp 




04110 


eb6f 


90 Oc 






bcc 


div700 


yes 


04111 


eb71 


e6 le 






inc 


result 


no — fix RESULT 


04112 


eb73 


dO 06 






bne 


div600 




04113 


eb75 


e6 If 






inc 


result+l 




04114 


eb77 


dO 02 






bne 


div600 




04115 


eb79 


e6 20 






inc 


result+2 




04116 


eb7b 


85 23 




div600 


sta 


accuKH-l 


new remainder 


04117 


eb7d 


60 




div700 


rts 






04U8 


eb7e 














04119 


eb7e 














04120 


eb7e 


==> Zero RESULT 


<~= 






04121 


eb7e 














04122 


eb7e 


a9 00 




zerres 


Ida #$00 




04123 


eb80 


85 le 






sta 


result 




04124 


eb82 


85 If 






sta 


result+l 




04125 


eb84 


85 20 






sta 


result+2 




04126 


eb86 


60 






rts 






04127 


eb87 














04128 


eb87 


20 8a 


eb 


accx4 


jsr 


accx2 


Multiply ACCUM by 2 


04129 


ebSa 














04130 


ebSa 














04131 


ebSa 















validate, memory, block commands 



page ...87 



line 


addr 


object 


source code 


04132 


ebSa 


=> Multiply ACCUM by 2 <= 


04133 


eb8a 






04134 


ebSa 


18 


accx2 clc 


04135 


ebSb 


26 23 


acc200 rol accujiH-1 


04136 


eb8d 


26 24 


rol accua'f2 


04137 


eb8f 


26 25 


rol accuiiH-3 


04138 


eb9l 


60 


rts 


04139 


eb92 






04140 


eb92 






04141 


eb92 


===> Add 


ACCUM to RESULT <==. 


04142 


eb92 






04143 


eb92 


18 


addres clc 


04144 


eb93 


a2 fd 


Idx #$fd 


04145 


eb95 


b5 21 


addlOO Ida result+3,x 


04146 


eb97 


75 26 


ado accum+4,x 


04147 


eb99 


95 21 


sta result+3,x 


04148 


eb9b 


eS 


inx 


04149 


eb9c 


dO f7 


bne add 100 


04150 


eb9e 


60 


rts 


04150 


eb9f 






04151 


eb9f 




.lib tst2 



RESULT=RESULT+ACCUM+l ,2,3 



tst2-4 



page 



.88 



line 


addr 


object 


source 


code 




04153 


eb9f 


=> mark 


track & 


sector as used 


<== 


04154 


eb9£ 










04155 


eb9£ 


20 b4 eb 


usedts 


jar freuse 


Calculate BAM index for FRETS and 
USEDTS 


04156 


eba2 


fO Of 




beq userts 


used, no action 


04157 


eba4 


bl 02 




Ida (bmpnt),y 


get bits 


04158 


eba6 


5d ce eb 




eor bmask, X 


mark sector used 


04159 


eba9 


91 02 




sta (bmpnt),y 




04160 


ebab 


a4 04 




Idy temp 


index to free sector counter 


04161 


ebad 


bl 02 




Ida (bmpnt),y 


get count 


04162 


ebaf 


e9 00 




sbc #$00 


decrement I (0=0) 


04163 


ebbl 


91 02 




sta (bmpnt),y 


save it 


04164 


ebb3 


60 


userts 


rts 




04165 


ebb4 










04166 


ebb4 










04167 


ebb4 


===> Calculate BAM index for FRETS and USEDTS <== 


04168 


ebb4 










04169 


ebb4 


a5 13 


freuse 


Ida track 


.A= track*4 


04170 


ebb6 


Oa 




asl a 




04171 


ebb7 


Oa 




asl a 


4 bytes in BAM per track 


04172 


ebbS 


85 04 




sta temp 


save index 


04173 


ebba 


a5 14 




Ida sector 


.A= sector /8 


04174 


ebbc 


4a 




Isr a 


divide by 8 to find out which 


04175 


ebbd 


4a 




Isr a 


of the three bytes for this track 


04176 


ebbe 


4a 




Isr a 


the sector is in 


04177 


ebbf 


38 




sec 




04178 


ebcO 


65 04 




adc temp 


calculate index 


04179 


ebc2 


a8 




tay 




04180 


ebc3 


a5 14 




Ida sector 




04181 


ebc5 


29 07 




and #%lll 


find bit position 


04182 


ebc7 


aa 




tax 




04183 


ebc8 


bl 02 




Ida (bmpnt),y 


get the byte 


04184 


ebca 


3d ce eb 




and bmask, X 


test it 


04185 


ebcd 


60 




rts 


Z-1: used Z=0:free 


04186 


ebce 










04187 


ebce 










04188 


ebce 


==> BAM mask byt 


es <= 




04189 


ebce 










04190 


ebce 


01 02 04 


bmask 


.byte 1,2,4,8, 


16,32,64,128 


04191 


ebdl 


08 10 20 








04192 


ebd4 


40 80 








04193 


ebd6 










04194 


ebd6 










04195 


ebd6 


— ■> Double buffering: toggle active buffer number in BUFNUM <== 


04196 


ebd6 










04197 


ebd6 


a6 15 


dblbuf 


; Idx lindx 




04198 


ebdS 


b5 49 




Ida bufO,x 


toggle active flag 


04199 


ebda 


49 80 




eor #$80 




04200 


ebdc 


95 49 




sta bufO,x 




04201 


ebde 


b5 51 




Ida bufl.x 


toggle active flag 


04202 


ebeO 


49 80 




eor #$80 




04203 


ebe2 


95 51 




sta bufl,x 




04204 


ebe4 


20 95 fa 




jsr getact 


Get active buffer number 



tst2-4 



page ...89 



line addr object source code 



04205 

04206 

04207 

04208 

04209 

04210 

04211 

04212 

04213 

04214 

04215 

04216 

04217 

04218 

04219 

04220 

04221 

04222 

04223 

04224 

04225 

04226 

04227 

04228 

04229 

04230 

04231 
04232 

04233 
04234 
04235 
04236 
04237 
04238 
04239 
04240 
04241 
04242 
04243 
04244 
04245 
04246 
04247 
04248 
04249 
04250 
04251 
04252 
04253 
04254 
04255 



ebe7 

ebeS 

ebeb 

ebeb 

ebeb 

ebeb 

ebeb 

ebed 

ebef 

ebf2 

ebfS 

ebf7 

eb£9 

ebfb 

ebfd 

ebfd 

ebfd 

ebfd 

ebfd 

ebff 

ecOl 

ec03 

ec05 

ec08 

ecOa 

ecOc 

ecOf 
ecOf 

ecll 
eel 4 
eel 4 
eel 6 
eel 9 
eclb 
ecle 
ecle 
ec20 
ee22 
ec25 
ee27 
ec29 
ec2b 
ec2e 
ec30 
ec32 
ee33 
ee33 
ee36 
ec37 
ec37 
ec37 



aa 

4c 87 ec 



tax 

Jmp watjob 



Wait until buffer ready 



===> Write byte to internal channel <= 



a2 12 
86 16 
20 89 ed 
20 35 da 
a5 16 
e9 Of 
fO 23 
dO 08 



pibyte Idx #iwsa 
stx sa 

pbyte jsr fndweh 
Jsr setlds 
Ida sa 
cmp #15 
beq 142 
bne 140 



SA of internal write channel 
current SA 

find unused write channel 
Turn on LED for current drive 

using coBBiand channel? 

yes 

no 



=> Main routine to write to channel <= 



a5 17 
29 8f 
c9 Of 
bO 19 
20 a6 ed 
bO 05 
a5 18 
4c le ee 



dO 03 

4c 94 fb 

a5 18 
20 b6 ee 
a4 15 
4c e7 ef 

a9 06 
85 15 
20 el fO 
c9 29 
fO 05 
a5 18 
20 b6 ec 
a5 aO 
fO 01 
60 



put 



140 



141 



146 



142 



Ida orgsa 
and #%1000nil 
cmp #15 
bcs 142 
jsr typfil 
bcs 141 
Ida data 
jmp wrtbyt 



bne 146 



ee 47 43 
60 



150 



145 



Jmp 


wrtrel 


Ida 


data 


jsr 


putbyt 


Idy 


lindx 


jmp rnget2 


Ida #emdehn 


sta 


llndx 


jsr 


getpnt 


cmp 


#41 


beq 


150 


Ida 


data 


jsr 


putbyt 


Ida 


eoiflg 


beq 


145 


rts 




inc 


cmdwat 


rts 





coromand or data channel? 

<15 means a data channel 

Get current file type 

branch if random 

seq file 

Write character to the active 

channel 

if Z not set, we are writing 

USR file 

Write out relative records 

USR file — write byte 

to new channel 

and prepare for next byte 



test if command buffer full (>40) 



not yet, so store 

byte 

test if last byte of message 



set command waiting flag 



tst2-4 



page 



.90 



line 


addr 


object 




source 


code 




04256 


ec37 


=== 


=> Test 


if job (,X) 


is done yet 


and redo if necessary <=== 


04257 


ec37 
















04258 


ec37 


bd 


03 


10 


tat job 


Ida 


jobs.x 


value from job queue >127? 


04259 


ec3a 


30 49 






bnii 


notyet 




04260 


ec3c 


c9 02 






cmp 


#$02 


if <2, job is completed with no 


















errors 


04261 


ec3e 


90 


3d 






bcc 


ok 




04262 


ec40 


de 


5d 


43 




dec 


errcnt.x 


redu until error count 


04263 


ec43 


10 3a 






bpl 


again 




04264 


ec45 


2c 


9e 


43 




bit 


jobrtn 


return with .A=error? 


04265 


ec48 


30 


33 






bffli 


ok 




04266 


ec4a 


2c 


5c 


43 


recov 


bit 


revcnt 


error recovery count 


04267 


ec4d 


30 


29 






bmi 


rec4 


no recovery 


04268 


ec4f 


98 








tya 






04269 


ec50 


48 








pha 






04270 


ec51 


bd 


4e 


43 




Ida 


1st job, X 


restore head to track 1 


04271 


ec54 


29 


01 






and #$01 




04272 


ec56 


09 


cO 






ora 


#bump 




04273 


ec58 


9d 


03 


10 




sta 


jobs.x 


queue 


04274 


ec5b 


bd 


03 


10 


reel 


Ida 


jobs.x 




04275 


ec5e 


30 


fb 






bmi 


red 




04276 


ec60 


ad 


5c 


43 




Ida 


revcnt 


error recovery count 


04277 


ec63 


29 


3f 






and #%unn 




04278 


ec65 


a8 








tay 






04279 


ec66 


bd 


4e 


43 


rec2 


Ida 


1st job, X 


set last Job 


04280 


ec69 


9d 


03 


10 




sta 


jobs.x 




04281 


ec6c 


bd 


03 


10 


rec3 


Ida 


Jobs.x 


wait 


04282 


ec6f 


30 


fb 






bmi 


rec3 




04283 


ec71 


c9 


02 






cmp 


#$02 


recovery worked if error code <2 


04284 


ec73 


90 06 






bcc 


rec5 




04285 


ec75 


88 








dey 




it didn't work, but try a few times 


04286 


ec76 


dO 


ee 






bne 


rec2 




04287 


ec78 


4c 


25 


d9 


rec4 


jmp 


error 


give up! 


04288 


ec7b 
















04289 


ec7b 


68 






rec5 


pla 




it worked! restore .Y 


04290 


ec7c 


a8 








tay 






04291 


ec7d 


18 






ok 


clc 






04292 


ec7e 


60 








rts 




C=0 


04293 


ec7f 
















04294 


ec7f 


bd 


4e 


43 


again 


Ida 


Istjob.x 




04295 


ec82 


9d 


03 


10 




sta 


jobs.x 




04296 


ec85 


38 






notyet 


: sec 






04297 


ec86 


60 








rts 




C=1 


04298 


ec87 
















04299 


ec87 
















04300 


ec87 




=> Wait until job is completed 


<=== 


04301 


ec87 
















04302 


ec87 


20 37 


ec 


watjob jsr 


tstjob 


Teat if job (.X) is done yet and 


















redo if necessary 


04303 


ec8a 


bO 


fb 






bcs 


watjob 


Wait until Job is completed 


04304 


ec8c 


48 








pha 




clear job return flag 


04305 


ec8d 


a9 00 






Ida #$00 




04306 


ec8f 


8d 9e 


43 




sta 


jobrtn 


set job completed flag 



l:st2-4 



page 



.91 



line addr object source code 



04307 

04308 

04309 

04310 

04311 

04312 

04313 

04314 

04315 

04316 

04317 

04318 

04319 

04320 

04321 

04322 

04323 

04324 

04325 

04326 

04327 

04328 

04329 

04330 

04331 

04332 

04333 

04334 

04335 

04336 

04337 

04338 

04339 

04340 

04341 

04342 

04343 

04344 

04345 

04346 

04347 

04348 

04349 

04350 

04351 

04352 

04353 

04354 

04355 

04356 

04357 

04358 

04359 



ec92 

ec93 

ec94 

ec94 

ec94 

ec94 

ec94 

ec97 

ec98 

ec99 

ec9a 

ec9b 

ec9d 

ecaO 

eca2 

ecaS 

eca7 

ecaS 

eca9 

ecac 

ecaf 

ecb2 

ecb5 

ecb6 

ecb6 

ecb6 

ecb6 

ecb6 

ecb7 

ecba 

ecbc 

ecbd 

ecbf 

ecc2 

ecc2 

ecc3 

ecc4 

ecc5 

ecc7 

ecc9 

ecca 

ecca 

ecca 

ecca 

ecca 

ecca 

eccd 

ecdO 

ecd3 

ecd5 

ecd8 

ecdb 

ecde 



68 
60 



pla 
rta 



recover error code 



===> Set up header for active buffer <= 



20 95 fa 

Oa 

Oa 

Oa 

aS 

a5 13 

99 23 10 

a5 14 

99 24 10 

a5 12 

Oa 

bd 40 43 
99 21 10 
bd 41 43 
99 22 10 
60 



sethdr jsr getact 



seth 



asl a 

asl a 

aal a 

tay 

Ida track 

sta hdrs+2,y 

Ida sector 

sta hdrs+3,y 

Ida drvnum 

asl a 

tax 

Ida dskid.x 

sta hdrs,y 

Ida dskld+1 ,x 

sta hdrs+l,y 

rts 



Get active buffer number 



set track & 



sector 

get proper ID 



now move ID numbers 



==> Byte to active buffer of LINDEX channel <=== 



48 putbyt pha 

20 95 fa jsr getact 

10 06 bpl putbl 

68 pla 

a9 61 Ida #filnop 

4c c9 db jmp cmderr 

Oa putbl asl a 

aa tax 

68 pla 

81 29 sta (buftab.x) 

f6 29 Inc buftab.x 

60 rts 



Get active buffer number 
branch if there is one 
no buffer error 

command level error 

save buffer number 

save data byte 

lo 

increment buffer pointer 

Z=l if last character slot in buffer 



===> Initialize drive(s) — disk command <= 
and find active buffer number (LINDX) 



20 d2 db 
20 ff ec 
ad 91 
10 Oc 
20 8c 
20 35 



intdrv 



43 



dd 
da 



20 ff ec 
20 8c dd 



jsr simprs 
jsr initdr 
Ida image 
bpl id20 
Jsr togdrv 
jsr setlds 
jsr initdr 
jsr togdrv 



parse the disk command 
initialize drives 
flag for both drives 

Toggle drive number 

Turn on LED for current drive 

Toggle drive number 



tst2-4 



page ...92 



line addr object source code 



04360 
04361 
04362 
04363 
04364 
04365 
04366 
04367 
04368 
04369 
04370 
04371 
04372 
04373 
04374 

04375 
04376 

04377 
04378 
04379 
04380 
04381 
04382 

04383 
04384 
04385 
04386 
04387 
04388 
04389 
04390 
04391 
04392 
04393 
04394 
04395 
04396 
04397 
04398 
04399 
04400 

04401 
04402 

04403 
04404 
04405 
04406 



ecel 
ece4 
ece4 
ece6 
ece7 
ece9 
eceb 
eced 
ecef 
ecfl 
ecf3 
ecf6 
ecf8 
ecfa 
ecfc 

ecff 
ecff 

ed02 
ed05 
ed07 
edOa 
edOc 
edOe 

edll 
edl3 
ed14 
ed15 
edl8 
edlb 
edle 
ed21 
ed22 
ed22 
ed22 
ed22 
ed22 
ed25 
ed28 
ed2b 
ed2e 
ed30 

ed33 
ed35 

ed37 
ed39 
ed3a 
ed3a 



4c 9f db ld20 Jmp endcmd 



a5 12 
18 
69 Oc 

85 al 
a2 12 

86 13 
a2 00 
86 14 

20 97 ec 
a6 al 
a5 12 
09 bO 
4c 9d fl 



20 e4 ec 
a9 00 
99 24 10 
a5 12 
09 80 
20 9d fl 

a5 12 
Oa 

b9 21 10 
9d 40 43 
b9 22 10 
9d 41 43 
60 



Inltsu Ida drvnum 
clc 

adc #$0c 
sta jobnum 
Idx #18 
stx track 
Idx #0 
stx sector 
Jsr seth 
Idx Jobnum 
Ida drvnum 
ora #seek 
Jmp dolt 



20 54 ef inltdr jsr cldchn 



Jsr Inltsu 
Ida #$00 
sta hdrs+3,y 
Ida drvnum 
ora #$80 
jsr doit 

Ida drvnum 

asl a 

tax 

Ida hdrs,y 

sta dskld.x 

Ida hdrs+l,y 

sta dskld+l,x 

rts 



Terminate command successfully 
current drive number 



current Job number 
prepare to read BAM 



set up seek Image of BAM header 
current Job number 
current drive number 

Do job, set up error count and exit 
if error returns 

Close all channels except the 
command channel 



sector 

get proper ID 

Do job, set up error count and exit 

if error returns 

set master ID for diskette 



=> Start double buffering (reading ahead) <= 



20 94 ec 
20 46 ed 
20 87 ec 
20 b8 ed 
85 13 
20 b8 ed 

85 14 
a5 13 

dO 01 
60 



strdbl jsr sethdr 
jsr rdbuf 
Jsr watjob 
Jsr getbyt 
sta track 
Jsr getbyt 

sta sector 
Ida track 

bne strl 
rts 



20 d6 eb strl jsr dblbuf 



Set up header for active buffer 
read next block into data buffer 
Wait until Job is completed 
read track link in the active buffer 

read sector link In the active 
buffer 

if not 0, we're not at the end of 
file 



set up buffers & pointers for double 
buffering 



tst2-4 



page 



.93 



line 


addr 


object 


source code 


04407 


ed3d 


20 94 


ec 




Jsr sethdr 


04408 


ed40 


20 46 


ed 




jsr rdbuf 


04409 


ed43 


4c d6 


eb 




Jmp dblbuf 


04410 


ed46 










04411 


ed46 


a9 80 




rdbuf 


Ida #read 


04412 


ed48 


dO 02 






bne strtit 


04413 


ed4a 










04414 


ed4a 


a9 90 




wrtbuf Ida #write 


04415 


ed4c 


8d 3c 


43 


strtit sta cmd 


04416 


ed4f 


20 95 


fa 




jsr getact 


04417 


ed52 


aa- 






tax 


04418 


ed53 


20 Oe 


fl 




jsr setljb 


04419 


ed56 


8a 






txa 


04420 


ed57 


48 






pha 


04421 


ed58 


Oa 






asl a 


04422 


ed59 


aa 






tax 


04423 


ed5a 


a9 00 






Ida #$00 


04424 


ed5c 


95 29 






sta buftab.x 


04425 


ed5e 


20 a6 


ed 




jsr typfil 


04426 


ed6l 


c9 04 






cmp #$04 


04427 


ed63 


bO 06 






bcs wrtcl 


04428 


ed65 


£6 59 






inc nbkl.x 


04429 


ed67 


dO 02 






bne wrtcl 


04430 


ed69 


f6 61 






inc nbkh,x 


04431 


ed6b 


68 




wrtcl 


pla 


04432 


ed6c 


aa 






tax 


04433 


ed6d 


60 






rts 


04434 


ed6e 










04435 


ed6e 










04436 


ed6e 


===> Find 


the assigned read clu 


04437 


ed6e 










04438 


ed6e 


a5 16 




fndrch 


Ida sa 


04439 


ed70 


c9 13 






cmp #iiiax3a+l 


04440 


ed72 


90 02 






bcc fndc20 


04441 


ed74 


29 Of 






and #%11U 


04442 


ed76 


c9 Of 




fndc20 


cmp #$0f 


04443 


ed78 


dO 02 






bne fndc25 


04444 


ed7a 


a9 10 






Ida #err8a 


04445 


ed7c 


aa 




fndc25 


tax 


04446 


ed7d 


38 






sec 


04447 


ed7e 


b5 a2 






Ida lintab.x 


04448 


ed80 


30 06 






bmi fndc30 


04449 


ed82 


29 Of 






and #%im 


04450 


ed84 


85 15 






sta lindx 


04451 


ed86 


aa 






tax 


04452 


ed87 


18 






clc 


04453 


ed88 


60 




fndc30 


rts 


04454 


ed89 










04455 


ed89 










04456 


ed89 











set up header for active buffer 
read next block into data buffer 
set up buffers and pointers 



temporary job command 
Get active buffer number 

Set up job using last job's drive 

•A = job number, .X = buffer 

number. Transfer and 

save 

multiply by 2 

and use as 

index in 

buffer table 

Get current file type 

sequential? 

no 

block count lo 

block count hi 
original bufferf 



current not too high (>19)7 



mask off high order bits — $U=$1 , 
$12=$2 



SA 

channel number 

bit 7 set — no channel 

current channel number 



tst2-4 



page 



.94 



line addr object 



source code 



04457 
04458 
04459 
04460 
04461 
04462 
04463 
04464 
04465 
04466 
04467 
04468 
04469 
04470 
04471 
04472 
04473 
04474 
04475 
04476 
04477 
04478 
04479 
04480 
04481 
04482 
04483 
04484 
04485 
04486 
04487 
04488 
04489 
04490 
04491 
04492 
04493 
04494 
04495 
04496 
04497 
04497 
04498 



ed89 
ed89 
ed89 
ed8b 
ed8d 
ed8f 
ed91 
ed92 
ed94 
ed95 
ed96 
ed98 
ed9a 
ed9b 
ed9d 
ed9f 
edaO 
edal 
eda2 
eda2 
eda4 
eda5 
eda6 
eda6 
eda6 
eda6 
eda6 
eda8 
edaa 
edab 
edad 
edaf 
edbO 
edbO 
edbO 
edbO 
edbO 
edb3 
edb4 
edb5 
edb7 
edbS 
edbS 



sss> Find the assigned write channel <- 



a5 16 
c9 13 
90 02 

29 Of 
aa 

b5 a2 
a8 
Oa 
90 Oa 

30 Oa 
98 

29 Of 
85 15 
aa 

18 
60 

30 f6 
38 

60 



fndwch Ida 
cmp 
bcc 
and 

fndwl3 tax 
Ida 
tay 
asl 
bcc 
bml 

fndwlO tya 
and 
sta 
tax 
clc 
rts 



fndwl5 bml fndwlO 
fndw20 sec 
rts 



sa 

#maxsa+l 

fndwl3 

#znii 

lintab,x 



fndwl5 
fndw20 



nun 

lindx 



=> Get current file type <= 

a6 15 typfil Idx lindx 

b5 90 Ida filtyp.x 

4a Isr a 

29 07 and #%in 

c9 04 cmp #reltyp 

60 rts 



=> Set buffer pointers <= 

20 95 fa getpre Jsr getact 
Oa asl a 

aa tax 

a4 15 Idy lindx 

60 rts 



current SA >19? 



channel number 



channel assigned (bit 7 set) 

not assigned (7 and 6 set) 

original SA 

mask off hi 

currently active channel 



bit 6 set: inactive channel 

abort after setting the carry flag 



logical index, channel number 
file type flags, channel 0-7 
divide by 2, mask hi bits 

if relative, set Z 



Get active buffer number 



current channel number 



.lib getbyt 



get byte, R/W, free buffer, channels 



page 



.95 



line addr object source code 



04500 

04501 

04502 

04503 

04504 

04505 

04506 

04507 

04508 

04509 

04510 

04511 

04512 

04513 

04514 

04515 

04516 

04517 

04518 

04519 

04520 

04521 

04522 

04523 

04524 

04525 

04526 

04527 

04528 

04529 

04530 

04531 

04532 

04533 

04534 

04535 
04536 

04537 
04538 
04539 
04540 
04541 
04542 
04543 
04544 
04545 
04546 
04547 
04548 
04549 
04550 



edbS 

edbS 

edbS 

edbS 

edbb 

edbe 

edcO 

edc2 

edc3 

edc5 

edcB 

edca 

edcc 

edce 

edcf 

eddl 

edd2 

edd4 

edd6 

edd7 

edd7 

edd7 

edd7 

edd7 

edd7 

edda 

eddc 

edde 

edel 

ede3 

ede5 

ede8 

edea 

edeb 

edeb 

edee 
edfO 

edf3 
edf6 
edfS 
edfa 
edfc 
edff 
eeOl 
ee04 
ee07 
eeOa 
eeOd 
eelO 
eel 2 
eel 3 



==> Read one byte from the active buffer <== 

Set flag if last data byte, then yes: Z=l else Z=0 



00 



20 bO ed 
b9 bd 00 
fO 12 
a1 29 
48 

b5 29 
d9 bd 
dO 04 
a9 ff 
95 29 
68 

f6 29 
60 

al 29 
f6 29 
60 



getbyt Jsr 
Ida 
beq 
Ida 
pha 
Ida 
cmp 
bne 
Ida 
sta 

getb2 pla 
inc 
rts 

getbl Ida 
inc 
rts 



Set buffer pointers 

channel last character pointer 



getpre 

lstchr,y 

getbl 

(buftab.x) data byte to stack 



buftab,x 

Istchr.y 

getb2 

#$ff 

buftabjX 

buftab.x 

(buftab,x) 
buftab,x 



compare pointer to 
character read 



if last byte, set Z 



===> Read byte from file <== 

and read next block of file if needed 



20 b8 ed 
dO 36 
85 18 
b9 bd 00 
fO 08 
a9 80 
99 98 00 
a5 18 
60 



rdbyt 



Jsr getbyt 
bne rd3 
sta data 
Ida Istchr.y 
beq rdl 
Ida #eoiout 
sta chnrdy.y 
Ida data 
rts 



20 d6 eb rdl jsr dblbuf 



a9 00 
20 cl fO 

20 b8 ed 
c9 00 
fO 19 
85 13 
20 b8 ed 
85 14 
20 d6 eb 
20 54 ee 
20 94 ec 
20 46 ed 
20 d6 eb 
a5 18 
60 



rd3 



Ida #$00 
jsr setpnt 

jsr getbyt 
cmp #$00 
beq rd4 
sta track 
jsr getbyt 
sta sector 
jsr dblbuf 
jsr setdrn 
jsr sethdr 
jsr rdbuf 
jsr dblbuf 
Ida data 
rts 



Read one byte from the active buffer 



channel last character pointer 

last byte read 
channel status 



Double buffer: switch 
active/inactive buffers 

Set up pointer into active data 

buffer 

Read one byte from the active buffer 

no next block 

Read one byte from the active buffer 



Set drive number 

Set up header for active buffer 

read in next block 

toggle buffers 



get byte, R/W, free buffer, channels 



page 



.96 



line 


addr 


object 


source 


code 




04551 


eel 3 


20 bS ed 


rd4 


jsr getbyt 


Read one byte from the active bufl 


OA552 


eel 6 


a4 15 




Idy lindx 


current channel# 


04553 


eel8 


99 bd 00 




sta l3tchr,y 


channel last character pointer 


04554 


eelb 


a5 18 




Ida data 




04555 


eeld 


60 




rts 




04556 


eele 










04557 


eele 










04558 


eele 


==> Write character to the active 


channel <== 


04559 


eele 


If this fills the buffer, write buffer to disk 


04560 


eele 










04561 


eele 


20 b6 ec 


wrtbyt Jsr putbyt 


Byte to active buffer of LINDEX 












channel 


04562 


ee21 


fO 01 




beq wrtO 


buffer full 


04563 


ee23 


60 




rts 




04564 


ee24 










04565 


ee24 


20 54 ee 


wtO 


jsr setdrn 


Set drive number 


04566 


ee27 


20 bO d6 




Jsr nxtts 


Find the next available track and 
sector 


04567 


ee2a 


a9 00 




Ida #$00 




04568 


ee2c 


20 cl fO 




jsr setpnt 


Set up pointer into active data 
buffer 


04569 


ee2f 


a5 13 




Ida track 




04570 


ee31 


20 b6 ec 




jar putbyt 


store links 


04571 


ee34 


a5 14 




Ida sector 




04572 


ee36 


20 b6 ec 




jsr putbyt 




04573 


ee39 


20 4a ed 




jsr wrtbuf 


write out buffer 


04574 


ee3c 


20 d6 eb 




Jsr dblbuf 


toggle 


04575 


ee3f 


20 94 ec 




Jsr sethdr 


Set up header for active buffer 


04576 


ee42 


a9 02 




Ida #$02 


bypass track/sector link 


04577 


ee44 


4c cl fO 




Jmp setpnt 


Set up pointer into active data 
buffer 


04578 


ee47 










04579 


ee47 










04580 


ee47 


> Increment the pointer of the active buffer by .A <=== 


04581 


ee47 










04582 


ee47 




incpnt 






04583 


ee47 


85 04 


incptr 


sta temp 




04584 


ee49 


20 el fO 




jsr getpnt 


Get the active buffer pointer 


04585 


ee4c 


18 




clc 




04586 


ee4d 


65 04 




adc temp 




04587 


ee4f 


95 29 




sta buftab.x 


lo 


04588 


ee51 


85 27 




sta dirbuf 


directory buffer pointer 


04589 


ee53 


60 




rts 




04590 


ee54 










04591 


ee54 










04592 


ee54 


— => Set 


drive number same as last job <= 


04593 


ee54 










04594 


ee54 


20 95 fa 


setdri 


I jsr getact 


Get active buffer number 


04595 


ee57 


aa 




tax 




04596 


ee58 


bd 4e 43 




Ida Istjob.x 


last Job by buffer 


04597 


eeSb 


29 01 




and #$0l 




04598 


eeSd 


85 12 




sta drvnum 


current drive number 


04599 


ee5f 


60 




rts 





get byte, R/W, free buffer, channels 



page 



.97 



line addr object source code 



04600 


ee60 










04601 


ee60 










04602 


ee60 


=> Open 


a new write channel <= 


._ 


04603 


ee60 










04604 


ee60 


38 


getwch sec 


we want a write channel: C=l 


04605 


ee61 


bO 01 




bcs getr2 




04606 


ee63 










04607 


ee63 










04608 


ee63 


===> Open 


a new read channel <== 




04609 


ee63 










04610 


ee63 


18 


getrch clc 


0=0 for read 


04611 


ee64 


08 


getr2 


php 


save R/W flag 


04612 


ee65 


85 04 




sta temp 


save buffers we need 


04613 


ee67 


20 a4 ee 




jsr frechn 


Free channel associated with SA 


04614 


ee6a 


20 79 ef 




jsr fndlnx 


find next free channel, allocate it 


04615 


ee6d 


85 15 




sta llndx 


use as current channel* 


04616 


ee6f 


a6 16 




Idx sa 


current SA 


04617 


ee7l 


28 




pip 


check R/W 


04618 


ee72 


90 02 




bcc getr55 


read 


04619 


ee74 


09 80 




ora #%1 0000000 


write 


04620 


ee76 


95 a2 


getr55 


1 sta lintab,x 


bit 7 set for a write channel 


04621 


ee78 


29 3f 




and #zoonian 


mask off write channel bit 


04622 


ee7a 


a8 




tay 




04623 


ee7b 


a9 ff 




Ida #$ff 


deallocate associated buffers 


04624 


ee7d 


99 49 00 




sta bufO.y 




04625 


eeSO 


99 51 00 




sta bufl.y 




04626 


ee83 


c6 04 




dec temp 


number of buffers to allocate 


04627 


ee85 


30 Ic 




bml getr4 




04628 


ee87 


20 03 ef 




Jsr getbuf 


Get a free buffer 


04629 


ee8a 


10 08 




bpl getr5 


no more 


04630 


ee8c 


20 cf ee 


gberr 


Jsr relbuf 


no buffers available I 


04631 


eeSf 


a9 70 




Ida #nochnl 




04632 
04633 


ee9r 
ee94 


4c c9 db 




Jmp cmderr 


Command level error handling 


04634 


ee94 


99 49 00 


getrS 


sta bufO.y 


channel buffer table 1 


04635 


ee97 


c6 04 




dec temp 




04636 


ee99 


30 08 




bmi getr4 




04637 


ee9b 


20 03 ef 




Jsr getbuf 


Get a free buffer 


04638 


ee9e 


30 ec 




bmi gberr 




04639 


eeaO 


99 51 00 




sta bufl.y 


channel buffer table 2 


04640 


eea3 


60 


getr4 


rta 




04641 


eea4 










04642 


eea4 










04643 


eea4 


===> Free 


channel 


associated with 


SA <= 


04644 


eea4 










04645 


eea4 


a5 16 


frechn 


Ida sa 


current SA 


04646 


eea6 


c9 Of 




cmp #15 


comgand channel 


04647 


eeaS 


dO 01 




bne freco 


Free data channel associated with SA 


04648 


eeaa 


60 




rts 


must not free command channel I 


04649 


eeab 










04650 


eeab 











get byte, R/W, free buffer, channels 



page 



.98 



line 


addr 


object 


source 


1 code 




04651 


eeab 


==> Free 


data channel associated 


with SA <== 


04652 


eeab 










04653 


eeab 


a6 16 


freco 


Idx sa 


current SA 


04654 


eead 


b5 a2 




Ida llntab.x 


current status SA 


04655 


eeaf 


c9 ff 




cmp #$ff 




04656 


eebl 


fO lb 




beq fre25 




04657 


eeb3 


29 3f 




and #xooimn 


mask off hi bits 


04658 


eeb5 


85 15 




sta lindx 


channel* 


04659 


eeb7 


a9 ff 




Ida #$ff 


free it 


04660 


eeb9 


95 a2 




sta lintab,x 




04661 


eebb 


20 cf ee 




jsr relbuf 


Release buffers associated with 
channel 


04662 


eebe 


a6 15 




Idx lindx 


channel* 


04663 


eecO 


a9 01 




Ida #$01 




04664 


eec2 


ca 


rell5 


dex 




04665 


eec3 


30 03 




bmi rellO 


no lower channel numbers 


04666 


eec5 


Oa 




asl a 


shift a bit 


04667 


eec6 


dO fa 




bne rell 5 


.AOO (always) 


04668 


eec8 


Od 48 43 


rellO 


era linuse 


free channel (l»free) 


04669 


eecb 


8d 48 43 




sta linuse 


LINDX use word 


04670 


eece 


60 


fre25 


rts 




04671 


eecf 










04672 


eecf 










04673 


eecf 


=> Release buffers associated with channel <= 


04674 


eecf 










04675 


eecf 


a6 15 


relbuf 


Idx lindx 


logical index, channel* 


04676 


eedl 


b5 49 




Ida bufO,x 


channel buffer table I 


04677 


eed3 


c9 ff 




cmp #$ff 


free? 


04678 


eed5 


fO 09 




beq rell 




04679 


eed7 


48 




pha 


save it 


04680 


eedS 


a9 ff 




Ida #$ff 


free it 


04681 


eeda 


95 49 




sta bufO.x 




04682 


eedc 


68 




pla 


buffer! 


04683 


eedd 


20 34 ef 




jsr frebuf 


Free buffer in BUFUSE 


04684 


eeeO 


a6 15 


rell 


Idx lindx 


channel! 


04685 


eee2 


b5 51 




Ida bufl ,x 


buffer! 


04686 


eee4 


c9 ff 




cmp #$ff 


free? 


04687 


eee6 


fO 09 




beq rel2 




04688 


eeeS 


48 




pha 


save it 


04689 


eee9 


a9 ff 




Ida #$ff 


free the 


04690 


eeeb 


95 51 




sta bufl,x 


buffer 


04691 


eeed 


68 




pla 


buffer! 


04692 


eeee 


20 34 ef 




jsr frebuf 


free it 


04693 


eefl 


a6 15 


rel2 


Idx lindx 


channel! 


04694 


eef3 


b5 79 




Ida ss,x 


side sector for this channel 


04695 


eefS 


c9 ff 




cmp #$ff 


free? 


04696 


eef7 


fO 09 




beq rel3 




04697 


eef9 


48 




pha 


save side sector 


04698 


eefa 


a9 ff 




Ida #$ff 


free pointer in 


04699 


eefc 


95 79 




sta ss,x 


side sectors table 


04700 


eefe 


68 




pla 


side sector 


04701 


eeff 


20 34 ef 




jsr frebuf 


free buffers in BUFUSE 


04702 


ef02 


60 


rel3 


rts 





get byte, R/W, free buffer, channels 



page .,,99 



line addr object source code 



04703 

04704 

04705 

04706 

04707 

04708 

04709 

04710 

04711 

04712 

04713 

04714 

04715 

04716 

04717 

04718 

04719 

04720 

04721 

04722 

04723 

04724 

04725 

04726 

04727 

04728 

04729 

04730 

04731 

04732 

04733 

04734 

04735 

04736 

04737 

04738 

04739 

04740 

04741 

04742 



ef03 

ef03 

ef03 

ef03 

ef03 

ef05 

ef07 

ef09 

efOc 

efOf 

efll 

efT3 

efl4 

efl6 

efl7 

efl9 

eflb 

efld 

eflf 

ef22 

ef24 

ef27 

ef28 

ef29 

ef29 

ef2c 

ef2f 

ef30 

ef32 

ef34 

ef34 

ef34 

ef34 

ef34 

ef36 

ef37 

ef38 

ef3a 

ef3d 

ef40 



===> Get a free buffer <= 



a9 ff 

85 05 
a2 Of 

2e 3e 43 
2e 3f 43 
bO 05 

86 05 
38 

bO 13 
ca 

10 fO 
a6 05 
30 Oa 
a9 00 
9d 03 10 
a5 12 
9d 4e 43 
8a 
60 

2e 3e 43 
2e 3f 43 
ca 

10 f7 
30 e5 



getbuf 
getbul 



getbu2 
getbu4 



getb5 



Ida #$ff 

sta tl 

Idx #15 

rol bufuse 

rol bufuse+1 

bcs getbu2 

stx tl 

sec 

bcs getbu3 

dex 

bpl getbul 

Idx tl 

bml getb5 

Ida #$00 

sta Jobs,x 

Ida drvnum 

sta lstJob,x 

txa 

rts 



getbu3 rol bufuse 
rol bufuse+l 
dex 

bpl getbu3 
bml getbu4 



==> Free buffer in BUFUSE <= 



29 Of 

a8 

c8 

a2 10 

6e 3f 43 

6e 3e 43 

88 



04743 ef41 dO 01 

04744 ef43 18 

04745 ef44 ca 

04746 ef45 10 f3 

04747 ef47 60 

04748 ef48 

04749 ef48 

04750 ef48 



frebuf and #$0f 

tay 

iny 

Idx #16 
frebl ror bufuse+l 

ror bufuse 

dey 

bne freb2 
clc 
freb2 dex 



bpl frebl 
rts 



buffer count 

find which buffer in use 

found one 



try the next one 



queue 

current drive number 

last Job by buffer 



buffer allocation 



mask off hi bits 



2*8 bits — loop 16 times 



to count down to 0. When .Y=0, the 

bit that 

corresponds to the buffer we want is 

in the 

carry flag, so we clear the carry to 

free 

that buffer. When .X reaches $FF, 

the bits 

are all back in the right places 



get byte, R/W, free buffer, channels 



page . . 1 00 



line 


addr 


object 


source 


1 code 




04751 


ef48 


S£S= 


=> Clear 


all channels except the 


command channel <== 


04752 


ef48 












04753 


ef48 


a9 


Oe 


clrchn Ida #14 




04754 


ef4a 


85 


16 




sta sa 


current SA 


04755 


ef4c 


20 


a4 ee 


clrcl 


Jsr frechn 


Free channel associated with SA 


04756 


ef4f 


c6 


16 




dec sa 


current SA 


04757 


ef51 


dO 


f9 




bne clrcl 




04758 


ef53 


60 






rts 




04759 


ef54 












04760 


ef54 












04761 


ef54 


= 


■> Close all channels except the 


command channel <= 


04762 


ef54 












04763 


ef54 


a9 


14 


cldchn Ida #$14 




04764 


ef56 


85 


16 




sta sa 


current SA 


04765 


ef58 


a6 


16 


clsd 


Idx sa 


use as index 


04766 


ef5a 


b5 


a2 




Ida lintab,x 


current status SA 


04767 


ef5c 


c9 


ff 




cmp #$ff 


none assigned 


04768 


efSe 


fO 


14 




beq cld2 




04769 


ef60 


29 


3f 




and #%00mni 


mask off hi bits 


04770 


ef62 


85 


15 




sta llndx 


current channel# 


04771 


ef64 


20 95 fa 




jsr getact 


Get active buffer number 


04772 


ef67 


aa 






tax 




04773 


ef68 


bd 


4e 43 




Ida 1st job, x 


last job by buffer 


04774 


ef6b 


29 


01 




and #$01 




04775 


ef6d 


c5 


12 




cmp drvnum 


current drive number 


04776 


ef6f 


dO 03 




bne cld2 




04777 


ef71 


20 a4 ee 




jsr frechn 


Free channel associated with SA 


04778 


ef74 


c6 


16 


cld2 


dec sa 


current SA 


04779 


ef76 


10 eO 




bpl clsd 




04780 


ef78 


60 






rts 




04781 


ef79 












04782 


ef79 


aO 00 


fndlnx 


: Idy #$00 




04783 


ef7b 


a9 01 




Ida #$01 




04784 


ef7d 


2c 


48 43 


fndlO 


bit llnuse 


test if sane bit set in LINUSE and 

.A 

when set, corresponding channel is 


04785 


ef80 


dO 09 




bne fnd30 














free 


04786 


ef82 


c8 






iny 


counter 


04787 


ef83 


Oa 






asl a 


test next bit on the left 


04788 


ef84 


dO 


f7 




bne fndlO 


more testing needed 


04789 


ef86 


a9 


70 




Ida #nochnl 




04790 


ef88 


4c 


c9 db 




Jmp cmderr 


Command level error handling 


04791 


ef8b 












04792 


ef8b 


49 


ff 


fnd30 


eor #$ff 


toggle bit mask 


04793 


ef8d 


2d 


48 43 




and llnuse 


mark bit used 


04794 


ef90 


8d 


48 43 




sta llnuse 




04795 


ef93 


98 






tya 




04796 


ef94 


60 






rts 




04797 


ef95 












04798 


ef95 













get byte, R/W, free buffer, channels 



page ..101 



line addr object source code 



04799 

04800 

04801 

04802 

04803 

04804 

04805 

04806 

04807 

04808 

04809 

04810 

04811 

04812 

04813 

04814 

04815 

04816 

04817 

04818 

04819 

04820 

04821 

04822 

04823 

04824 

04825 

04826 

04827 

04828 

04829 

04830 

04831 

04832 

04833 

04834 

04835 

04836 

04837 

04838 

04839 

04840 

04841 

04842 



ef95 

ef95 

ef95 

ef98 

ef9b 

ef9e 

efaO 

efa2 

efa3 

efa3 

efa3 

efa3 

efa3 

efa5 

efaS 

efaa 

efad 

efad 

efaf 

efbl 

efb3 

efb5 

efb7 

efb9 

efbc 

efbe 

efcO 

efc2 

efc4 

efc7 

efc7 

efc9 

efcb 

efcc 

efcc 

efce 

efdO 

efd3 

efd5 

8fd7 

efda 

efdc 

efdf 

efel 



04843 efe3 

04844 efeS 

04845 efe7 

04846 efe9 

04847 efec 

04848 efee 



=■> Get next byte from channel <= 
gbyte 



20 6e ed 
20 35 da 
20 a3 ef 
a6 15 
b5 b5 
60 



jsr fndrch 
jsr setlds 
jsr get 
Idx llndx 
Ida chndat.x 
rts 



Find an unused read channel 

Turn on LED for current drive 

Get next byte from any type of file 

current channel# 

channel data byte 



=> Get next byte from any type of file <= 



a6 15 
20 a6 ed 
dO 03 
4c 01 fc 

a5 16 
c9 Of 
fO 59 
b5 98 
29 08 
dO 13 
20 a6 ed 
c9 07 
dO 07 
a9 89 
95 98 
4c d7 ef 

a9 00 
95 98 
60 

a5 16 
fO 31 
20 a6 ed 
c9 04 
90 22 
20 bO ed 
b5 29 
d9 bd 00 
dO 04 
a9 00 

95 29 
f6 29 
a I 29 
99 b5 00 
b5 29 
d9 bd 00 



get 



getOO 



getO 



getl 



Idx lindx 

Jsr typfil 

bne getOO 

Jmp rdrel 

Ida sa 
cap #$0f 
beq geterc 
Ida chnrdy,x 
and #eoisnd 
bne getl 
jsr typfil 
crap #dirtyp 
bne getO 
Ida #rndrdy 
sta chnrdy.x 
jmp rndget 

Ida #notrdy 
sta chnrdy,x 
rts 



04849 effl dO 05 



Ida sa 
beq get6 
jar typfil 
cmp #$04 
bcc seqget 
rndget jsr getpre 

Ida buftab.x 
cmp Istchr.y 
bne rngetl 
Ida #$00 

sta buftab,x 
rngetl inc buftab,x 
rnget2 Ida (buftab.x) 
sta chndat,y 
Ida buftab.x 
cmp Istchr.y 

bne rnget3 



logical index, channel* 
Get current file type 

Read relative records 

current SA 

Get byte from error channel 
was last character just sent? 
just sent BOI 
no, not this time 
Get current file type 

not direct type 
direct files stays active 
talker listener no EOI 
prepare next character 

last character sent, not ready 



test if a load 

test for random file 



Set buffer pointers 
data byte pointer 
last character? 

yes, so vn:ap pointer around to start 
again 

point to next character 

data byte to 

channel data byte 

is this the 

last character we're supposed to 

get? 



get byte, R/W, free buffer, channels 



page ..102 



line 


addr 


object 




source 


code 




04850 


eff3 


a9 81 






Ida #rndeoi 


yes. 


04851 


eff5 


99 98 


00 




sta chnrdy.y 


send EOI with it 


04852 


eff8 


60 




rnget3 


rts 




04853 


eff9 












04854 


eff9 


20 d7 


ed 


seqget Jsr rdbyt 


Read byte from file 


04855 


effc 


a6 15 




get3 


Idx lindx 


channel# 


04856 


effe 


95 b5 






sta chndat,x 


channel data byte 


04857 


fOOO 


60 






rts 




04858 


fOOl 












04859 


fOOl 


ad 46 43 


get6 


Ida dirlst 


looks like a load. Or a directory 














listing? 


04860 


f004 


fO f3 






beq seqget 


no 


04861 


f006 


20 la 


db 




jsr getdir 


Get character for directory loading 


04862 


f009 


4c fc 


ef 




jmp get3 




04863 


fOOc 












04864 


fOOc 












04865 


fOOc 


===> Get byte from error channel 


<== 


04866 


fOOc 












04867 


fOOc 


20 el 


fO 


geterc 


Jsr getpnt 


Get the active buffer pointer 


04868 


fOOf 


c9 db 






crap #<errbuf-l 




04869 


foil 


dO 18 






bne gelO 




04870 


f013 


a5 28 






Ida dirbuf+T 


current buffer pointer hi 


04871 


f015 


c9 43 






cmp #>errbuf 




04872 


f017 


dO 12 






bne gelO 




04873 


f019 


a9 Od 






Ida #cr 


carriage return 


04874 


fOlb 


85 18 






sta data 




04875 


fOld 


20 4b 


da 




jsr erroff 


turn off error led 


04876 


f020 


a9 00 






Ida #$00 




04877 


f022 


20 d7 


d9 




jsr errtsO 


transfer message to error buffer 


04878 


f025 


c6 47 






dec cb+2 




04879 


f027 


a9 80 






Ida #eoiout 




04880 


f029 


dO 12 






bne ge30 


jump 


04881 


f02b 


20 b8 


ed 


gelO 


jsr getbyt 


Read one byte from the active buffe 


04882 


f02e 


85 18 






sta data 




04883 


f030 


dO 09 






bne ge20 




04884 


f032 


a9 db 




gel5 


Ida #<errbuf-l 




04885 


f034 


20 cl 


fO 




jsr setpnt 


Set up pointer into active data 
buffer 


04886 


f037 


a9 43 






Ida #>errbuf 




04887 


f039 


95 2a 






sta buftab+l ,x 


hi 


04888 


f03b 


a9 88 




ge20 


Ida #rdytlk 




04889 


f03d 


85 9f 




ge30 


sta chnrdy+errchn 


04890 


f03f 


a5 18 






Ida data 




04891 


f04l 


85 be 






sta chndat+errchn 


04892 


f043 


60 






rts 




04893 


f044 












04894 


f044 


follow track/sector links, set End-Of-Flle when track link is zero 


04895 


f044 












04896 


f044 


20 95 


fa 


nxtbui 


: jsr getact 


Get active buffer number 


04897 


f047 


Oa 






asl a 




04898 


£048 


aa 






tax 




04899 


f049 


a9 00 






Ida #$00 




04900 


f04b 


95 29 






sta buftab.x 


lo 



get byte, R/W, free buffer, channels 



page ..103 



line addr object source code 



04901 

04902 

04903 

04904 

04905 

04906 

04907 

04908 

04909 

04910 

04911 

04912 

04913 

04914 

04915 

04916 

04917 

04918 

04919 

04920 

04921 

04922 

04923 

04924 

04925 

04926 

04927 

04928 

04929 

04930 

04931 

04932 
04933 
04934 

04935 
04936 
04937 
04938 
04939 
04940 
04941 

04942 
04943 
04944 
04945 
04946 
04947 
04948 
04949 
04950 



f04d 

f04f 

f051 

f053 

f056 

f056 

f057 

f057 

f057 

f057 

f057 

f059 

f05b 

f05b 

f05b 

f05b 

f05b 

f05d 

f05f 

f062 

f064 

f067 

f069 

f06c 

f06c 

f06c 

f06c 

f06c 

f06e 

f070 

f072 

f074 
f077 
f079 

f07c 
f07c 
f07c 
f07c 
f07c 
f07e 
f080 

f083 
f083 
f083 
f083 
f083 
f086 
f088 
f08a 
f08d 



al 29 
fO 05 
d6 29 
4c d7 

60 



ed 



Ida (buftab.x) 
beq nxtbl 
dec buftab,x 
Jmp rdbyt 



track link zero? 

no more blocks 

$FF, force read of next sector 

Read byte from file 



nxtbl rts 



=> Direct block read <= 



a9 80 
dO 02 



drtrd Ida #read 
bne drt 



=> Direct block write <= 



a9 90 
05 12 
8d 3c 43 
a5 al 
20 97 ec 
a6 al 
4c aO f 1 



drtwrt Ida #vfrite 



drt 



ora drvnura 
sta cmd 
Ida Jobnum 
jsr seth 
Idx Jobnum 
Jmp doit2 



current drive number 
temporary Job command 
current Job number 

current Job number 



===> Open internal read channel (SA=17) <== 



a9 11 
85 16 
a9 01 
85 c5 

20 47 f7 
a9 02 
4c cl fO 



opnird Ida #irsa 
sta sa 
Ida #$01 

opntyp sta type 

jsr opnrch 
Ida #$02 
jmp setpnt 



current SA 
prg 
entry point for any file type 

Open a read channel with two buffers 

point past tr/sec link 

Set up pointer into active data 

buffer 



===> Open internal write channel (SA=18) <= 



a9 1 2 opnirw Ida #iwsa 

85 16 sta sa 

4c e6 f 7 Jmp opnwch 



current SA 

Open a write channel with 

buffers 



two 



===> Allocate next directory block <= 



20 3b f9 
a9 01 
85 04 
ad 44 43 
48 



nxdrbk Jsr curblk 
Ida #$01 
sta temp 
Ida secinc 
pha 



Read track & sector from header 



sector increment for SEQ routine 



get byte, R/W, free buffer, channels 



page . . 1 04 



line 


addr 


object 


source 


code 




04951 


f08e 


a9 


03 




Ida #3 


increment for directory 


04952 


f090 


8d 


44 43 




sta seclnc 


sector increment for SEQ routim 


04953 


f093 


20 


b7 d6 




jsr nxtds 


determine next available 
track/ sector 


04954 


f096 


68 






pla 




04955 


f097 


8d 


44 43 




sta secinc 




04956 


f09a 


a9 


00 




Ida #$00 




04957 


f09c 


20 


cl fO 




jsr setpnt 


Set up pointer into active data 
buffer 


04958 


f09f 


a5 


13 




Ida track 




04959 


fOal 


20 


b6 ec 




jsr putbyt 


store links in buffer 


04960 


fOa4 


a5 


14 




Ida sector 




04961 


f0a6 


20 


b6 ec 




jar putbyt 




04962 


fOa9 


20 


4a ed 




jsr wrtbuf 


write buffer out 


04963 


fOac 


20 87 ec 




Jsr watjob 


Wait until job is completed 


04964 


fOaf 


a9 


00 




Ida #$00 


point to track byte 


04965 


fObl 


20 


cl fO 




jsr setpnt 




04966 


fOb4 


20 


b6 ec 


nzdbl 


jsr putbyt 


zero the buffer 


04967 


fOb7 


dO 


fb 




bne nxdbl 




04968 


fOb9 


20 


b6 ec 




jsr putbyt 


store as next track link 


04969 


fObc 


a9 


ff 




Ida #$ff 




04970 


fObe 


4c 


b6 ec 




jmp putbyt 


and $FF as sector link 


04971 


fOcI 












04972 


fOcl 












04973 


fOcl 


= 


=> Set 1 


up point 


er into active data buffer <== 


04974 


fOcl 












04975 


fOcl 


85 


04 


setpnt 


sta temp 




04976 


fOc3 


20 


95 fa 




jsr getact 


Get active buffer number 


04977 


fOc6 


Oa 






asl a 




04978 


fOc7 


aa 






tax 




04979 


f0c8 


b5 


2a 




Ida buftab+l,x 


move hi byte of buffer pointer 


04980 


fOca 


85 


28 




sta dirbuf+1 




04981 


fOcc 


a5 


04 




Ida temp 


store new buffer pointer 


04982 


fOce 


95 


29 




sta buftab,x 




04983 


fOdO 


85 


27 




sta dirbuf 




04984 


fOd2 


60 






rts 




04985 


f0d3 












04986 


f0d3 












04987 


fOd3 


=> Free 


both internal channels 


<T-r.-i 


04988 


fOd3 












04989 


f0d3 


a9 


11 


freich 


Ida #irsa 




04990 


f0d5 


85 


16 




sta sa 


current SA 


04991 


f0d7 


20 


a4 ee 




jsr frechn 


free internal read channel 


04992 


fOda 


a9 


12 




Ida #lwsa 




04993 


fOdc 


85 


16 




sta sa 


current SA 


04994 


fOde 


4c 


a4 ee 




jmp frechn 


free internal write channel 


04995 


fOel 












04996 


fOel 


.^ 


»> Get the active buffer pointer <= 


04997 


fOel 












04998 


fOel 


20 95 fa 


getpnt jsr getact 


Get active buffer number 


04999 


fOe4 






setdir 






05000 


fOe4 


Oa 




gpl 


asl a 




05001 


fOeS 


aa 






tax 





get byte, R/W, free buffer, channels 



page ..105 



line addr object 



source code 



05002 
05003 
05004 
05005 
05006 
05007 
05008 
05009 
05010 
05011 
05012 
05013 
05014 

05015 
05016 
05017 
05018 
05019 
05020 
05021 
05022 
05023 
05024 
05025 
05026 
05027 
05028 
05029 
05029 
05030 



f0e6 
fOeS 
fOea 
fOec 
fOee 
fOef 
fOef 
fOef 
fOef 
fOef 
fOfl 
fOf4 
fOf5 

fOfS 
fOfa 
fOfc 
fOfe 
fOff 
fOff 
fOff 
fOff 
fOff 
fl02 
fl05 
fl06 
f109 
flOa 
flOd 
flOe 
flOe 



b5 2a 
85 28 
b5 29 
85 27 
60 



Ida buftab+l.x 
sta dirbuf+1 
Ida buftab,z 
sta dirbuf 
rts 



hi 

current buffer pointer hi 

lo 

directory buffer pointer 



===> Direct read of a byte (.A = position) <» 



85 06 
20 95 fa 

bd f£ £0 

85 07 
aO 00 
bl 06 
60 



drdbyt sta t2 

Jsr getact 

tax 

Ida bufind,x 

sta t3 
Idy #$00 
Ida (t2),y 
rts 



Get active buffer number 

hi byte table of pointers to data 

buffer 

create pointer to (T2) 

byte we want 



=> hi byte table of pointers to data buffer <== 

11 12 13 buflnd .byte $11, $12, $13 

20 21 22 .byte $20, $21, $22, $23 

23 

30 31 32 .byte $30, $31, $32, $33 

33 

40 41 42 .byte $40, $41, $42, $43 

43 

.lib jobs 



Jobs, adfil, open 



page 



.106 



line 


addr 


object 




source 


code 






05032 


flOe 


=> Set 


up job using 


last job' 


s drive, job code in CMD <= 


05033 


flOe 














05034 


flOe 


bd 4e 


43 


setljb 


Ida 


1st job, X 


last job by buffer 


05035 


fill 


29 01 






and 


#$01 


leaves just the drive number 


05036 


£113 


Od 3c 


43 




ora 


cmd 


temporary Job command 


05037 


fll6 














05038 


fll6 














05039 


fll6 


==> Set 1 


up new job <= 


ESS 




05040 


fll6 














05041 


fll6 


48 




setjob pha 






05042 


fll7 


86 al 






stx 


Jobnum 


current job number 


05043 


fll9 


8a 






txa 




transfer buffer number 


05044 


flla 


Oa 






asl 


a 


multiply 


05045 


fllb 


Oa 






asl 


a 


by 


05046 


flic 


Oa 






asl 


a 


8 


05047 


flld 


aa 






tax 






05048 


file 


bd 24 


10 




Ida 


hdrs+3,x 


move desired sector 


05049 


fl21 


8d 3c 


43 




sta 


cmd 


temporary job command 


05050 


fl24 


bd 23 


10 




Ida hdrs+2,x 


then load the track 


05051 


fl27 


fO 2c 






beq 


tserr 




05052 


£129 


c5 24 






cmp 


maxtrk 


highest possible track number is 3 


05053 


fl2b 


bO 28 






bcs 


tserr 




05054 


fl2d 


aa 






tax 




track number 


05055 


fl2e 


68 






pla 




check for write 


05056 


fl2f 


48 






pha 






05057 


fl30 


29 £0 






and #$£0 


mask off drive bits 


05058 


fl32 


c9 90 






cmp 


#wrlte 


is it a job code for write? 


05059 


fl34 


dO 52 






bne 


sjbl 




05060 


f136 


68 






pla 




Job code 


05061 


fl37 


48 






pha 






05062 


£138 


4a 






Isr 


a 


find drive to use 


05063 


fl39 


bO 05 






bcs 


sjb2 


if not drive #1, 


05064 


f13b 


ad 02 


41 




Ida 


bamOf2 


use drive #0. Load DOS version 


05065 


fl3e 


90 03 






bcc 


sjb3 




05066 


£140 


ad 02 


42 


sjb2 


Ida 


baml+2 


use drive #1. Load DOS version 


05067 


fl43 


£0 05 




sjb3 


beq 


sjb4 


if 00 (no number) it's OK 


05068 


f145 














05069 


fl45 


****************************************************************** 


05070 


f145 


Since 


the 


1 DOS version code - normally 65 (a) - is stored in RAM on 


05071 


fl45 


the 4040 and 8x50, it 


can be soft-set by the user. On the 1541, 


05072 


fl45 


however , 


this is 


impossible because the code is stored in ROM. 


05073 


f145 


A DOS version of $00 : 


is OK. 




05074 


£145 


«*«««:M<**«*««4>*4>«<M>«Mi<M>**««4<<M>*«*4>4<*«*>M'*«4i*«*****«4'*«*4>«««**««* 


05075 


£145 














05076 


fl45 


cd 9£ 


10 




cmp 


vernum 


"a" - DOS version number 


05077 


£148 


dO 36 






bne 


vnerr 


Version error 


05078 


£14a 


8a 




sjb4 


txa 




track number 


05079 


fUb 


20 db d7 




jsr 


maxsec 


Tell how many sectors allowed for 
















this track 


05080 


£14e 


cd 3c 43 




cmp 


cmd 


temporary job command 


05081 


fl51 


£0 02 






beq 


tserr 




05082 


fl53 


bO 33 






bcs 


sjbl 




05083 


fl55 


20 5d 


£1 


tserr 


jsr 


hed2ts 


Set desired track and sector valui 



jobs, adfil, open 



page ..107 



line addr object source code 



05084 

05085 

05086 

05087 

05088 

05089 

05090 

05091 

05092 

05093 

05094 

05095 

05096 

05097 

05098 

05099 

05100 

05101 

05102 

05103 

05104 

05105 

05106 

05107 

05108 

05109 
05110 
05111 
05112 
05113 
05114 
05115 
05116 
05117 
05118 
05119 
05120 
05121 
05122 
05123 
05124 
05125 
05126 
05127 
05128 
05129 
05130 
05131 
05132 
05133 
05134 
05135 



fl58 
f15a 
fl5d 
f15d 
fl5d 
f15d 
fl5d 
f15f 
f160 
£161 
f162 
f163 
f166 
£168 
f16b 
£16d 
£16e 
£16e 
£16e 
fl6e 
f16e 
£170 
£172 
£174 
£176 

£179 
£17b 
£17d 
fl7f 
£180 
£180 
£180 
£180 
£180 
£183 
£185 
£188 
£188 
£188 
£188 
fl88 
£18a 
f18d 
£18f 
£192 
£193 
£196 
£199 
fl9c 
£19d 
£19d 
£19d 



a9 66 
4c 5c d9 



tserl 



Ida #badts 
Jmp cnider2 



===> Set desired track and sector values <= 



a5 al hed2ts Ida jobnum 

Oa asl a 

Oa asl a 

Oa asl a 

aa tax 

bd 23 10 Ida hdr3+2,x 

85 13 sta track 

bd 24 10 Ida hdr3+3,x 

85 14 ' sta sector 

60 rts 



current job number 

multiply 

by 

8 



current track number 
current sector number 



===> Check £or bad track and sector values <= 



a5 13 
£0 e6 
c5 24 
bO e2 
20 db d7 

c5 14 
£0 db 
90 d9 
60 



tschk 



Ida track 
beq tserl 
cmp maxtrk 
bcs tserl 
Jsr maxsec 

cmp sector 
beq tserl 
bcc tserl 
rts 



current track number 

36 is tops 

Tell how many sectors allowed £or 

this track 

current sector number 



===> Version error <= 



20 5d £1 
a9 73 
4c 5c d9 



jsr hed2ts 
Ida #cbmv2 
jmp cmder2 



==> Conclude job set up <== 
sjbl 



a6 al 
ad 5c 43 
29 1£ 
9d 5d 43 
68 

8d 3c 43 
9d 03 10 
9d 4e 43 
60 



Idx jobnum 
Ida revcnt 
and #$1£ 
sta errcnt.x 
pla 

sta cmd 
sta Jobs,x 
sta 1st job, X 
rts 



Set desired track and sector values 
version error 



current job number 
error recovery count 

sector o£ directory entry by bu£fer 

temporary job command 

queue 

last job by buf£er 



Jobs, adfll, open 



page ..108 



line addr object 



source code 



05136 
05137 
05138 
05139 
05140 
05U1 
05142 
05143 
05144 
05145 
05146 
05147 
05148 
05149 
05150 
05151 
05152 
05153 
05154 
05155 
05156 
05157 
05158 
05159 
05160 
05161 
05162 
05163 
05164 
05165 

05166 
05167 



fl9d 
fl9d 
fl9d 
flaO 
fla3 
fla6 
fla9 
f1a9 
fla9 
fla9 
fla9 
flab 
flac 
flae 
flaf 
flbl 
flb2 
flb4 
flb5 
flb7 
flb9 
flbc 
flbe 
flbf 
ficl 
flc3 
flc5 
flc7 
flea 
flcb 



=> Do Job, set up error count and exit if error returns <== 

8d 3c 43 dolt sta cmd temporary Job coomand 

ad 3c 43 doit2 Ida cmd temporary Job conmand 

20 16 fl Jsr set job Set up new Job 

4c 87 ec Jmp watjob Walt until Job is completed 



3> Add new filename to directory <= 



a5 16 

48 

a5 15 

48 

a5 14 

48 

a5 13 

48 

a9 11 

85 16 

20 3b f9 

a5 c5 

48 

a5 8b 

29 01 

85 12 

a6 al 

5d 4e 43 

4a 

90 Oc 



fled a2 01 
flcf 8e 98 43 



05168 fld2 20 da df 

05169 fld5 fO Id 

05170 fld7 dO 28 



05171 


fld9 


ad 97 43 


05172 


fide 


fO Oc 


05173 


fide 


c5 14 


05174 


fleO 


fO If 


05175 


fle2 


85 14 


05176 


fle4 


20 57 fO 


05177 


fle7 


4c 01 f2 


05178 


flea 




05179 


flea 


a9 01 


05180 


flee 


8d 98 43 


05181 


fief 


20 43 eO 


05182 


flf2 


dO Od 


05183 


flf4 


20 83 fO 



addfll Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
pha 
Ida 
sta 
jsr 
Ida 
pha 
Ida 
and 
sta 
Idx 
eor 
Isr 
bcc 



af08 



aflO 



afl5 



sa current secondary address 

lindx channel 

sector sector 

track track 

save these to stack 

#lrsa 17 = Internal read channel 

sa current secondary address 

curblk Read track & sector from header 

type current file type 

fildat drive in table 

#$01 

drvnum current drive number 

Jobnuffl current Job number 

1st Job, X same drive? 

a divide by 2 

af08 if clear, same drive as last Job 

Idx #$01 we're searching for a deleted entry 

stx delind pointer in directory for first 

available entry 

Jsr srehst Initiate search of directory 

beq afl5 entry found? no, start a new sector 

bne af20 found a spot, so find pointers to 

first character 

Ida delsec sector of first available entry 

beq aflO 0? no deleted entry found at last 

read 

cmp sector is this sector already in memory? 

beq af20 compare sector numbers. If equal, 

get pointers 

sta sector current sector number 

Jsr drtrd Direct block read 
jmp af20 

Ida #$01 we're looking for a deleted entry 

sta delind index of first available entry 

Jsr search Continue search of entries 

bne af20 found? 

Jsr nxdrbk Allocate next directory block 



jobs, adfil, open 



page ..109 



line addr object source code 



05184 
05185 
05186 
05187 
05188 
05189 

05190 
05191 
05192 
05193 
05194 
05195 

05196 
05197 
05198 

05199 
05200 
05201 
05202 
05203 
05204 
05205 
05206 
05207 

05208 

05209 

05210 

05211 

05212 

05213 

05214 

05215 

05216 

05217 

05218 

05219 

05220 

05221 

05222 

05223 

05224 

05225 

05226 

05227 

05228 

05229 

05230 

05231 

05232 



f1f7 
f1£9 
fife 
fife 
£201 
f204 

f207 
f208 
f20a 
f20c 
f20e 
f210 

f213 
f214 
f217 

f21a 
f21b 
f21e 
f221 
f224 
f225 
f228 
f229 
f22b 

f22e 
f230 
f232 
f234 
f235 
f237 
f239 
f23b 
f23d 
f23f 
f241 
f244 
f246 
f247 
f24a 
£24c 
f24d 
f250 
f252 
f255 
f256 
f258 
f259 
f25a 
f25c 



a5 14 
8d 97 43 
a9 02 
8d 98 43 
ad 98 43 
20 cl fO 

68 

85 c5 
c9 04 
dO 02 
09 80 
20 b6 ec 

68 

8d 86 43 

20 b6 ec 

68 

8d 8b 43 

20 b6 ec 

20 95 fa 

a8 

ad 80 43 

aa 

a9 10 

20 69 eO 

aO 10 
a9 00 
91 27 
c8 
cO lb 

90 f9 
a5 c5 
c9 04 
dO 13 
aO 10 
ad 4c 43 

91 27 
c8 

ad 4d 43 
91 27 
c8 

ad 4b 43 
91 27 
20 5b fO 
68 

85 15 
aa 
68 

85 16 
ad 97 43 



af20 



af25 



Ida sector 
sta delsec 
Ida #$02 
sta dellnd 
Ida dellnd 
jsr setpnt 

pla 

sta type 
cmp #reltyp 
bne af25 
ora #$80 
jsr putbyt 

pla 

sta filtrk 

Jsr putbyt 

pla 

sta filsec 

jsr putbyt 

jsr getact 

tay 

Ida filtbl 

tax 

Ida #16 

Jsr trname 



Idy 
Ida 
af30 sta 
iny 
cpy 
bcc 
Ida 
cmp 
bne 
Idy 
Ida 
sta 
iny 
Ida 
sta 
iny 
Ida 
sta 
jar 
pla 
sta 
tax 
pla 
sta 
Ida 



af50 



#16 

#$00 

(dirbuf),y 

#27 

af30 

type 

#reltyp 

afSO 

#16 

trkss 

(dirbuf),y 

secss 
(dirbuf),y 

rec 

(dlrbuf),y 

drtwrt 

lindx 



sa 
delsec 



current sector number 

sector of first available entry 

pointer in dir block 

index of first available entry 

Set up pointer into active data 

buffer 

current file type 
relative file? 

set bit 7 

Byte to active buffer of LINDEX 

channel 

track link 

Byte to active buffer of LINDEX 

channel 

sector link 

set link in table & entry 

Get active buffer number 

pointer to requested drive 

name length 

Transfer filename from command 

string to buffer 

pad with 00s 
& replace links 



current file type 

rel? 

no 

only for relative files 

track link for side sect to 

directory buffer pointer 

same with sector link 
directory buffer pointer 

and record length 
directory buffer pointer 
Direct block write 

logical index, channel number 



current secondary address 
sector of first available entry 



Jobs, adfil, open 



page ..110 



line addr object 



source code 



05233 

05234 

05235 

05236 

05237 

05238 

05239 

05240 

05241 

05242 

05243 

05244 

05245 

05246 

05247 

05248 

05249 

05250 

05251 

05252 

05253 

05254 

05255 

05256 

05257 

05258 

05259 

05260 

05261 

05262 

05263 

05264 

05265 

05266 

05267 

05268 

05269 

05270 

05271 

05272 

05273 

05274 

05275 

05276 

05277 

05278 

05279 

05280 

05281 

05282 

05283 

05284 



f25f 

£261 

£263 

£266 

£268 

£26a 

£26c 

£26f 

£271 

£272 

£274 

£276 

£278 

£279 

£279 

£279 

£279 

£279 

£27b 

£27e 

£281 

£284 

£287 

£28a 

£28c 

f28e 

£290 

£292 

£294 

£295 

£297 

£299 

£29a 

£29c 

f29e 

£2aO 

£2a3 

f2a6 

f2a8 

f2ab 

£2ad 

£2af 

£2b2 

£2b5 

£2b5 

£2b7 

f2b9 

£2bc 

f2be 

£2cl 

f2cl 

f2cl 



29 1£ 
85 86 
ad 98 43 
29 eO 
05 86 
85 86 
9d 6b 43 
a5 c5 
Oa 

29 le 
05 12 
85 8b 
60 



and #$1£ 
sta £llent 
Ida delind 
and #$eO 
era fllent 
sta £llent 
sta dlrent,x 
Ida type 
asl a 
and #$le 
ora drvnum 
sta £lldat 
rts 



=> Open a channel <= 



a5 16 
8d 3b 43 
20 b6 dc 
8e 7a 43 
ae 00 43 
ad 3b 43 
dO 29 
eO 2a 
dO 25 
a5 II 
£0 49 
4a 

85 13 
a9 00 
2a 

85 12 
09 04 
85 8b 
20 35 da 
ad 74 43 
85 14 
20 47 £7 
a5 8b 
a6 15 
99 90 00 
4c 9£ db 

eO 24 
dO Id 
ad 3b 43 
dO 03 
4c 09 £5 



open Ida 
sta 

Jsr 
stx 
Idx 
Ida 
bne 
cpx 
bne 
Ida 
beq 
Isr 
sta 
Ida 
rol 
sta 
ora 
sta 
jsr 
Ida 
sta 
jar 
Ida 
endrd Idx 
sta 



table o£ sector numbers in directory 
Index o£ first available entry 



index o£ directory entry by bu££er 
current file type 



current drive number 
drive number, pattern 



op021 



current secondary address 

temp for 1£ 

Initialize cmd tables & pointers 

1st input character 
temporary secondary address 
if not (LOAD) 

no 

last track or 

if 

current track number 



sa 

tempsa 

cradset 

cmdnum 

cmdbuf 

tempsa 

op021 

op021 

prgtrk 

op04l5 

a 

track 

#$00 

a 

drvnum current drive number 

ifprgtyp+prgtyp 

fildat drive number, pattern 

setlds Turn on LED for current drive 

prgsec last program sector 

sector current sector number 

opnrch Open a read channel with two buffers 

fildat drive number, pattern 

lindx logical index, channel number 

filtyp.y file type flags, channel 0-7 

endcmd Terminate command successfully 



cpx #'$' 
bne op041 
Ida tempsa 
bne op04 
Jmp loadir 



load the directory 
temporary secondary address 
Load the directory ($) 



jobs, adfil, open 



page ..111 



line addr object source code 



05285 

05286 

05287 

05288 

05289 

05290 

05291 

05292 

05293 

05294 

05295 

05296 

05297 

05298 

05299 

05300 

05301 

05302 

05303 

05304 

05305 

05306 

05307 

05308 

05309 

05310 

05311 

05312 

05313 

05314 

05315 

05316 

05317 

05318 

05319 

05320 

05321 

05322 

05323 

05324 

05325 

05326 
05327 
05328 
05329 
05330 
05331 
05332 
05333 
05334 
05335 
05336 



f2cl 

f2cl 

f2cl 

f2c4 

f2c6 

f2c8 

f2ca 

f2cc 

f2cf 

f2d1 

f2d3 

f2d6 

f2d6 

f2d8 

f2da 

f2dd 

f2dd 

f2df 

f2e2 

f2e4 

f2e6 

f2e9 

f2ec 

f2ef 

f2fl 

£2f3 

f2f5 

f2f6 

f2f8 

f2fa 

f2fd 

f2fd 

f2fe 

£300 

f301 

£304 

£306 

£309 

f30a 

£30d 

£310 

£313 
£316 
£318 
£31 b 
£31 e 
£320 
£321 
£324 
£326 
£329 
£32a 



==> Open directory as a sequential £ile <= 



20 d2 db 
a9 12 
85 13 
a9 00 
85 14 
20 47 £7 
a5 12 
09 02 
4c ad £2 

eO 23 
dO 12 
4c 37 e8 

a9 04 
8d 9c 43 
a9 00 

85 12 

8d 94 43 
20 ££ ec 
20 e6 db 
dO 04 
a2 00 
£0 Oc 
8a 

£0 05 
a9 30 
4c c9 db 

88 

£0 01 

88 

8c 80 43 

a9 8d 

20 69 dc 

e8 

8e 7e 43 

20 10 dd 

20 10 de 

20 c9 de 
a2 00 
8e 4b 43 
8e 9d 43 

86 c5 
e8 

ec 7d 43 

bO 10 

20 bf £4 

e8 

ec 7d 43 



op04 jsr simprs 
Ida #18 
sta track 
Ida #$00 
sta sector 
jsr opnrch 
Ida drvnum 
ora #seqtyp4-seqtyp 
Jmp endrd 



Simple parser 
directory track 
current track number 

current sector number 

Open a read channel with two bu££ers 

current drive number 

(2* the sequential file type) 



op04l cpx 
bne 
jmp 

op0415 Ida 
sta 
Ida 
sta 
sta 
jsr 

op042 jsr 
bne 
Idx 
beq 

op049 txa 



#•#• 

op042 

opnblk 



open for direct access 

Open direct access bu££er ("#") 



#prgtyp+prgtyp program type 
typflg match by type o£ £ile 



beq 
Ida 
jmp 



#$00 

drvnum 

Istdrv 

initdr 

pracln 

op049 

#$00 

op20 

oplO 

#badsyn 

cmderr 



oplO 



op20 



dey 

beq op20 

dey 

sty filtbl 

Ida #$8d 

jsr parse 

inx 

stx £2cnt 

jsr onedrv 

jsr optsch 

jsr £fst 

Idx #$00 

stx rec 

stx mode 

stx type 

inx 

cpx flcnt 

bcs op40 

jsr cktm 

inx 

cpx flcnt 



current drive number 

last drive without error: default 

Find colon in command string 
found ":"? 



found comma? 

something amiss 

Command level error handling 

so it points to the ":" 

character preceeding the colon 

pointer to drive in cmd 

look for shifted CR 

Store desired character in CHAR 

comma counter 

file stream 2 count 

Set first drive & table pointers 

Determine optimal search for LOOKUP 

and FINFIL 

Find starting entry in directory 

default 

record size 

active file mode (R/W) 

current file type 



if 0, no wild cards 
determine SPUR 

another wild card? 



Jobs, adfll, open 



page ..112 



line 


addr 


object 




source code 






05337 


f32d 


bO 


07 






bcs op40 


i£ 01, there's only one 




05338 


£32f 


cO 


04 






cpy #reltjrp 


REL? 




05339 


f331 


£0 


37 






beq op60 


i£ yes, set record size 




05340 


f333 


20 


bf 


£4 




jsr cktm 


determine R W A M 




05341 


f336 


ae 


3b 43 


op40 


Idx tempsa 


temporary secondary address 




05342 


£339 


86 


16 






stx sa 


current secondary address 




05343 


f33b 


eO 02 






cpx #2 


SA >1? 




05344 


f33d 


bO Ob 






bcs op45 


not load or save 




05345 


f33£ 


8e 


9d 


43 




stx mode 


0-READ/LOAD UWRITE/SAVE 




05346 


£342 


a5 


c5 






Ida type 


current £ile type 




05347 


£344 


dO 


la 






bne op50 


type from parameters 




05348 


£346 


a9 


02 






Ida #prgtyp 


•prg- 




05349 


£348 


85 


c5 






sta type 


current £ile type 




05350 


£34a 


a5 


c5 




op45 


Ida type 


current £ile type 




05351 


£34c 


dO 


12 






bne op50 


type £rom parameters 




05352 


f34e 


a5 


8b 






Ida £ildat 


drive number, pattern 




05353 


£350 


29 


Oe 






and ftypmsk 






05354 


£352 


4a 








Isr a 






05355 


£353 


85 


c5 






sta type 


type £rom £ile 




05356 


£355 


ad 


86 


43 




Ida filtrk 






05357 


£358 


29 


3£ 






and #$3£ 






05358 


£35a 


dO 04 






bne op50 


yes, it exists 




05359 


£35c 


a9 


01 






Ida #seqtyp 


•seq- 




05360 


f35e 


85 


c5 






sta type 


default is seq 




05361 


£360 


ad 


9d 


43 


op50 


Ida mode 


active file mode (R/W) 




05362 


£363 


c9 


01 






cmp #wtmode 


•W'7 




05363 


£365 


£0 


la 






beq op75 






05364 


£367 


4c 


£9 


£3 




Jmp op90 






05365 


£36a 
















05366 


£36a 












handle relative file: 




05367 


£36a 


be 


80 


43 


op60 


Idy £lltbl,x 


get record size 




05368 


£36d 


b9 


00 


43 




Ida ciiidbu£,y 


command buffer 




05369 


£370 


8d 


4b 


43 




sta rec 


record size 




05370 


£373 


ad 


86 43 




Ida £iltrk 






05371 


£376 


29 


3f 






and #$3£ 






05372 


£378 


dO 


be 






bne op40 


it's here — read 




05373 


f37a 


a9 


01 






Ida #wtmode 


use write to open 




05374 


f37c 


8d 


9d 


43 




sta mode 


active file mode (R/W) 




05375 


£37f 


dO 


b5 






bne op40 


branch always 




05376 


£381 


ad 


86 


43 


op75 


Ida £iltrk 






05377 


£384 


29 


80 






and #$80 


deleted file? 




05378 


£386 


aa 








tax 


if not. 




05379 


£387 


dO 


16 






bne op81 


"replace" character in file 


name? 


05380 


£389 


a9 


20 






Ida #$20 






05381 


f38b 


24 


8b 






bit £ildat 


was file closed properly? 




05382 


f38d 


£0 06 






beq op80 






05383 


£38£ 


20 


45 


e3 




jsr deldir 


Delete the entry in the directory 


05384 


£392 


4c 


9b £4 




jmp opwrt 


Open a file to write 




05385 


£395 
















05386 


£395 


ad 


86 43 


op80 


Ida £lltrk 






05387 


£398 


29 


3f 






and #$3£ 






05388 


£39a 


dO 


03 






bne op81 






05389 


f39c 


4c 


9b 


£4 




jmp opwrt 


Open a file to write 





jobs, adfil, open 



page ..113 



line addr object source code 



05390 


£39f 




05391 


f39f 




05392 


f39f 


ad 00 43 


05393 


f3a2 


c9 40 


05394 


f3a4 


fO Od 


05395 


f3a6 


8a 


05396 


f3a7 


dO 05 


05397 


f3a9 


a9 63 


05398 


f3ab 


4c c9 db 


05399 


f3ae 




05400 


f3ae 


a9 33 


05401 


f3b0 


4c c9 db 


05402 


f3b3 




05403 


f3b3 




05404 


£3b3 


a5 8b 


05405 


£3b5 


29 Oe 


05406 


f3b7 


4a 


05407 


f3b8 


c5 c5 


05408 


f3ba 


dO 64 


05409 


f3bc 


c9 04 


05410 


f3be 


fO 60 


05411 


f3c0 


20 e6 f7 


05412 


f3c3 


a5 15 


05413 


f3c5 


8d 75 43 


05414 


f3c8 


a9 11 


05415 


f3ca 


85 16 


05416 


£3cc 


20 6e ed 


05417 


f3cf 


ad 9a 43 


05418 


f3d2 


20 cl fO 


05419 


f3d5 


aO 00 


05420 


f3d7 


b1 27 


05421 


f3d9 


09 20 


05422 


f3db 


91 27 


05423 


f3dd 


aO la 


05424 


f3df 


a5 13 


05425 


f3el 


91 27 


05426 


f3e3 


c8 


05427 


f3e4 


a5 14 


05428 


f3e6 


91 27 


05429 


f3e8 


a5 86 


05430 


f3ea 


ae 75 43 


05431 


f3ed 


9d 6b 43 


05432 


f3f0 


20 3b f9 


05433 


f3f3 


20 5b fO 


05434 
05435 


f3f6 
f3f9 


4c a7 f4 


05436 


f3f9 


ad 86 43 



op81 Ida cffldbuf 
cmp #*@' 
beq op82 
txa 

bne op815 
Ida #flexst 
jmp cfflderr 

op815 Ida #badfn 
Jmp cmderr 



op82 Ida fildat 
and #typiiisk 
Isr a 
cmp type 
bne opll5 
cmp #reltyp 
beq opll5 
jsr opnwch 

Ida lindx 

sta wllndx 

Ida #lrsa 

sta sa 

jsr fndrch 

Ida Index 

Jsr setpnt 

Idy #$00 

Ida (dirbuf),y 

ora #$20 

sta (dirbuf),y 

Idy #26 

Ida track 

sta (dlrbuf),y 

iny 

Ida sector 

sta (dirbuf),y 

Ida filent 

Idx wlindx 

sta dirent.x 

jsr curblk 

jsr drtwrt 

jmp opfln 



op90 Ida filtrk 



*** "replace file" command detected 

here 

1st character input 

replace character 

Joker flag 

set? 

FILE EXISTS error 

Coomand level error handling 

Command level error handling 

This routine may have a bug! 
is directory file type 



same as in command line? 

REL? 

Open a write channel with two 

buffers 

logical index, channel number 

write LINDX 

to read internal channel 

current secondary address 

Find the assigned read channel 

current index in buffer 

Set up pointer into active data 

buffer 

set bit 5 In file type byte (file 

open) 

set replace bit 

directory buffer pointer 

current track number 

at position 26 

#27 

current sector number 

at position 27 in directory entry 

table of sector numbers in directory 

write LINDX 

index of directory entry by buffer 

Read track & sector from header 

Direct block write 

**************** 
**************** 



Jobs, adfil, open 



page ..114 



line addr object 



source code 



05437 

05438 

05439 

05440 

05441 

05442 

05443 

05444 

05445 

05446 

05447 

05448 

05449 

05450 

05451 

05452 

05453 

05454 

05455 

05456 

05457 

05458 

05459 

05460 

05461 

05462 

05463 

05464 

05465 

05466 

05467 

05468 

05469 

05470 

05471 

05472 

05473 

05474 

05475 

05476 

05477 

05478 

05479 

05480 

05481 



f3fc 
f3fe 
f400 
f402 
f405 
f405 
f408 
f40a 
f40c 
f40e 
f410 
£412 
f414 
f417 
f417 
f419 
f41a 
f41c 
£41 e 
£420 
£422 
£425 
£425 
£427 
£42a 
f42d 
£42£ 
£431 
£433 
£435 
£437 
£439 
f43b 
£43d 
£43e 
£440 
£442 
£445 
£448 
£449 
£44b 
£44e 
£451 
£453 
£455 



29 3f 
dO 05 
a9 62 
4c c9 db 

ad 9d 43 
c9 03 
£0 Ob 
a9 20 
24 8b 
£0 05 
a9 60 
4c c9 db 

a5 8b 
4a 

29 Of 
c5 c5 
£0 05 
a9 64 
4c c9 db 

aO 00 
8c 7f 43 
ae 9d 43 
eO 02 
dO la 
c9 04 
£0 eb 
bl 27 
29 4£ 
91 27 
a5 16 
48 

a9 11 
85 16 
20 3b £9 
20 5b £0 
68 

85 16 
20 5b £4 
ad 9d 43 
c9 02 
dO 52 
20 d£ £4 



oplOO 



opUO 



opll5 



and #$3£ 
bne op 100 
Ida #£lnt£d 
Jmp cmderr 

Ida mode 
cmp frndmode 
beq opIlO 
Ida #$20 
bit fildat 
beq opUO 
Ida #filopn 
Jmp cmderr 

Ida £lldat 
Isr a 
and #$0£ 
cmp type 
beq opl20 
Ida #mlstyp 
Jmp cmderr 



test i£ £ile exists 



i£ not 



opl20 Idy 
sty 
Idx 
cpx 
bne 
cmp 
beq 
Ida 
and 
sta 
Ida 
pha 
Ida 
sta 
Jsr 
jsr 
pla 
sta 

opl25 Jsr 
Ida 
cmp 
bne 
jsr 



#$00 

£2ptr 

mode 

#apmode 

opl25 

#reltyp 

opll5 

(dirbuf),y 

#$4£ 

(dirbu£),y 

sa 

#lrsa 
sa 

curblk 
drtwrt 



opread 

mode 

#apmode 

opfin 

append 



05482 £458 4c 9f db 

05483 £45b 

05484 £45b 

05485 f45b 



Jmp endcmd 



FILE NOT FOUND error 
Command level error handling 

active £ile mode (R/W) 
'M' (modify) 

check bit 5 

file closed properly? 

vnrite FILE OPEN error 
Command level error handling 

drive number, pattern 

mask 

type is in index table 

current file type 

FILE TYPE MISMATCH error 
Command level error handling 



file stream 2 pointer 
active file mode (R/W) 
'A' (Append)? 

REL? 

flag for open 

directory buffer pointer 
current secondary address 

Internal read channel 

current secondary address 

Read track & sector from header 

Direct block vorite 

restore If 

current secondary address 

Open a file to read 

active file mode (R/W) 

'A'? 

Read file, then append info to the 

end of it 

Terminate command successfully 



jobs, adfil, open 



page ..115 



line 


addr 


objec 


t 


source code 


05486 


f45b 


===> Open 


a £ile 


to read <= 


05487 


f45b 












05488 


f45b 


aO 13 




opread Idy 


#19 


05489 


f45d 


bl 27 






Ida 


(dirbu£),y 


05490 


f45f 


8d 4c 


43 




sta 


trkss 


05491 


f462 


c8 






Iny 




05492 


£463 


bl 27 






Ida 


(dirbuf),y 


05493 


f465 


8d 4d 


43 




sta 


secss 


05494 


f468 


c8 






iny 




05495 


f469 


bl 27 






Ida 


(dirbu£),y 


05496 


f46b 


ae 4b 


43 




Idx 


rec 


05497 


f46e 


8d 4b 


43 




sta 


rec 


05498 


£471 


8a 






txa 




05499 


£472 


£0 Oa 






beq opl30 


05500 


£474 


cd 4b 


43 




cmp 


rec 


05501 


£477 


£0 05 






beq opl30 


05502 


£479 


a9 50 






Ida #norec 


05503 


f47b 


20 c9 


db 




jsr 


cmderr 


05504 


£47e 












05505 


f47e 


ae 7f 


43 


opl30 


Idx 


£2ptr 


05506 


£481 


bd 86 


43 




Ida 


filtrk.x 


05507 


£484 


29 3f 






and #$3£ 


05508 


£486 


85 13 






sta 


track 


05509 


£488 


bd 8b 


43 




Ida 


£ilsec,x 


05510 


£48b 


85 14 






sta 


sector 


05511 


f48d 


20 47 


£7 




jsr 


opnrch 


05512 


£490 


a4 15 






Idy 


lindx 


05513 


£492 


ae 7f 


43 




Idx 


£2ptr 


05514 


£495 


b5 86 






Ida 


filent,x 


05515 


£497 


99 6b 


43 




sta 


dirent.y 


05516 


£49a 


60 






rts 




05517 


£49b 












05518 


f49b 












05519 


£49b 


===> Open 


a £ile 


to write <= 


05520 


£49b 












05521 


£49b 


a5 8b 




opwrt 


Ida 


£lldat 


05522 


£49d 


29 01 






and 


#$01 


05523 


£49£ 


85 12 






sta 


drvnum 


05524 


£4al 


20 e6 


£7 




Jsr 


opnwch 


05525 


£4a4 


20 a9 


£1 




jsr 


add£il 


05526 


£4a7 


a5 16 




op£in 


Ida 


sa 


05527 


£4a9 


c9 02 






cmp 


#$02 


05528 


f4ab 


bO Of 






bcs 


opfl 


05529 


£4ad 


20 3e 


£9 




jsr 


gethdr 


05530 


£4b0 


a5 13 






Ida 


track 


05531 


£4b2 


Oa 






asl 


a 


05532 


£4b3 


05 12 






ora 


drvnum 


05533 


£4b5 


85 11 






sta 


prgtrk 


05534 


f4b7 


a5 14 






Ida 


sector 


05535 


f4b9 


8d 74 


43 




sta 


prgsec 


05536 


£4bc 


4c 9f 


db 


opfl 


jmp 


endcmd 


05537 


f4bf 













track first side sector 
directory buffer pointer 
side sector track number 

sector first side sector 
side sector sector number 

record length 

record size 

record size 

previous length 

zero? 

same as current length? 

RECORD NOT PRESENT error 
Command level error handling 

file stream 2 pointer 



current track number 

current sector number 
Open a read channel with two buffers 
logical index, channel number 
file stream 2 pointer 



drive number, pattern 

mask off non-drive bits 

current drive number 

Open a write channel with two 

buffers 

Add new filename to directory 

current secondary address 

>1 , then not a program file 

current track link 

current drive number 

last program accessed 

current sector link 

last program sector 

Terminate command successfully 



Jobs, adfil, open 



page ..116 



line 


addr 


object 




source code 




05538 


f4bf 












05539 


f4bf 


==»> Check mode 


or £ile type <== 




05540 


f4bf 












05541 


f4bf 


be 80 43 


cktm 


Idy £iltbl,x 


get pointer 


05542 


f4c2 


b9 00 43 




Ida cindbu£,y 


get character 


05543 


f4c5 


aO 04 






Idy Inmodes 




05544 


f4c7 


88 




ckml 


dey 




05545 


f4c8 


30 08 






bffll ckm2 




05546 


f4ca 


d9 cb 


d2 




cmp modlst,y 


£ile modes R W A M 


05547 


f4cd 


dO £8 






bne ckml 




05548 


f4c£ 


8c 9d 


43 




sty mode 


12 3 


05549 


f4d2 


aO 05 




ckiii2 


Idy #ntype3 




05550 


f4d4 


88 




cktl 


dey 




05551 


f4d5 


30 07 






bmi ckt2 


no valid type 


05552 


f4d7 


d9 c£ 


d2 




cmp tplst.y 


file types D S P U L 


05553 


£4da 


dO £8 






bne cktl 




05554 


f4dc 


84 c5 






sty type 


12 3 4 


05555 


f4de 


60 




ckt2 


rts 




05556 


f4df 












05557 


f4df 












05558 


f4df 


==> Read 


£ile. 


then append in£o 


to the end of it <=== 


05559 


f4df 












05560 


f4df 


20 62 


e6 


append jsr gcbyte 


get a byte from the data channel 


05561 


f4e2 


a9 80 






Ida #lrf 




05562 


f4e4 


20 ae 


£8 




Jsr tst£lg 


is bit 7 in ($90, x) set (signals 


05563 


f4e7 


£0 £6 






beq append 


last byte in file)? 


05564 


f4e9 


20 97 


£9 




jsr rdlnk 


Set TRACK & SECTOR from link in 
buffer 


05565 


f4ec 


a6 14 






Idx sector 


sector link >255? 


05566 


f4ee 


e8 






inx 




05567 


f4ef 


8a 






txa 




05568 


f4fO 


dO 05 






bne ap30 


no 


05569 


f4f2 


20 24 


ee 




jsr wrtO 


get another block 


05570 


f4f5 


a9 02 






Ida #$02 


buffer pointer = 2 


05571 


f4f7 


20 cl 


£0 


ap30 


Jsr setpnt 


Set up pointer into active data 
buffer 


05572 


f4fa 


a6 15 






Idx lindx 


logical index, channel number 


05573 


f4fc 


a9 01 






Ida #$01 


set write flag 


05574 


f4fe 


95 98 






sta chnrdy.x 


write, read, eoi flags, channel 
status 


05575 


£500 


a9 80 






Ida #$80 


channel bit 


05576 


£502 


05 15 






ora lindx 


channel nr bit 7 set 


05577 


£504 


a6 16 






Idx sa 


current secondary address 


05578 


£506 


95 a2 






sta lintab.x 


to drive control table 


05579 


£508 


60 






rts 




05580 


£509 












05581 


£509 












05582 


£509 


=> Load 


the directory ($) <== 




05583 


£509 












05584 


£509 


a9 Ob 




loadir Ida #ldoiid 




05585 


fSOb 


8d 7a 


43 




sta cmdnum 




05586 


fSOe 


ae 79 43 




Idx cmdsiz 




05587 


£511 


ca 






dex 


-1 



jobs, adfil, open 



page ..117 



line addr object source code 



05588 f512 dO 17 

05589 f5U a9 2a 



05590 


f516 


8d 00 43 


05591 


f519 


a9 80 


05592 


f5lb 


8d 86 43 


05593 


£51 e 


Od 94 43 


05594 


f521 


85 8b 


05595 


f523 


ee 7d 43 


05596 


£526 


ee 7e 43 


05597 


£529 


dO 41 


05598 


£52b 




05599 


f52b 


ca 


05600 


f52c 


dO 26 


05601 


£52e 


ad 01 43 


05602 


£531 


20 bb dd 


05603 


£534 


30 1e 


05604 


£536 


29 01 


05605 


£538 


85 8b 


05606 


£53a 


85 12 


05607 


£53c 


20 £f ec 


05608 


£53f 


ee 7d 43 


05609 


£542 


ee 7e 43 


05610 


£545 


ee 80 43 


05611 


£548 


a9 80 


05612 


£54a 


8d 86 43 


05613 


f54d 


a9 2a 


05614 


f54£ 


8d 01 43 


05615 


£552 


dO 18 


05616 


£554 




05617 


£554 


20 e6 db 


05618 


£557 


dO 05 


05619 


£559 


20 df dc 


05620 


£55c 


aO 03 


05621 


f55e 


88 


05622 


£55£ 


88 


05623 


£560 


8c 80 43 


05624 


£563 


20 01 dc 


05625 


£566 


20 95 dd 


05626 


£569 


20 le dd 


05627 


£56c 


20 10 de 


05628 


f56£ 


20 b4 el 


05629 


£572 


20 c9 de 


05630 


£575 


20 54 da 


05631 


£578 


20 b8 ed 


05632 


£57b 


a6 15 


05633 


£57d 


95 b5 


05634 


£57f 


a5 12 


05635 


£581 


8d 94 43 



ld03 



Xd05 



IdlO 



bne IdOl 
Ida #'*• 

sta cmdbu£ 
Ida #$80 
sta £iXtrk 
ora Istdrv 
sta flldat 
inc flcnt 
Inc £2cnt 
bne IdlO 



IdOl dex 



bne ld03 
Ida ciiidbu£-l-1 
jsr tstOvl 
bmi ld03 
and #$0I 
sta flldat 
sta drvnum 
jsr initdr 
inc flcnt 
inc £2cnt 
inc filtbl 
Ida #$80 
sta filtrk 
Ida #•*' 
sta cmdbuf-t-l 
bne IdlO 

jsr prscin 
bne ld05 
jsr cmdrst 

Idy #$03 

dey 

dey 

sty filtbl 

jsr tc35 

jsr fslset 

jsr alldrs 
jsr optsch 

jsr newdir 
jsr ££st 
jsr stdir 
jsr getbyt 
Idx lindx 
sta chndat,x 
Ida drvnum 
sta Istdrv 



=0? 

general joker as 1st character to 

input buffer 

command buffer 

set joker flag 

first file link (track) 

last drive without error: default 

default flag drive number 

-1 

=1 

branch always 

more than one extra character 

following? 

yes 

should be drive number 

Test for or 1 

or 1 selected? no 

load one directory 

default flag drive number 

current drive number 

=1 

=1 

=1 

set joker flag 

first file link (track) 

as 2nd chr in input buffer 
always 

Find colon in command string 

•:• found 

Zero all important variables and 

pointers 



points to drive in cmd line 

parse and set tables 

Set pointers to one file stream and 

check type 

Set up all drives from F2CNT 

Determine optimal search for LOOKUP 

and FINFIL 

New directory in listing 

Find starting entry in directory 

Start directory loading 

Read one byte from the active buffer 

logical index, channel number 

data byte in output register 

current drive number 

current drive number 



Jobs, adfll, open 



page ..118 



line addr object 

05636 f584 09 04 

05637 £586 95 90 

05638 f588 a9 00 

05639 f58a 85 45 

05640 f58c 60 

05640 f58d 

05641 f58d 



source code 



ora #$04 

sta filtyp.x 

Ida #$00 

sta buftab+cbptr 

rts 

.lib close 



'prg' flag (shifted left) 
file type flags, channel 0-7 
reset input buffer pointer 



close, open channels 



page ..119 



line addr object source code 



05643 
05644 
05645 
05646 
05647 
05648 
05649 
05650 
05651 
05652 
05653 
05654 

05655 
05656 
05657 
05658 
05659 
05660 
05661 
05662 
05663 
05664 
05665 

05666 

05667 

05668 

05669 

05670 

05671 

05672 

05673 

05674 

05675 

05676 

05677 

05678 

05679 

05680 

05681 

05682 

05683 

05684 

05685 

05686 

05687 

05688 



f58d 
f58d 
f58d 
f58f 
f591 
f593 
f596 
f599 
f59c 
f59c 
f59e 
f5a0 

f5a3 
f5a5 
f5a7 
f5a9 
f5ac 
f5ac 
f5ac 
f5ac 
f5ac 
f5ae 
f5b0 

f5b3 
f5b5 
f5b7 
£5ba 
f5ba 
fSba 
f5ba 
fSba 
f5bc 
fSbe 
fScO 
f5c2 
£5c3 
f5c3 
f5c5 
f5c7 
f5ca 
f5cc 
£5ce 
f5d0 
f5d2 
f5d5 
f5d7 



==> Close the file related to the specified sec. address <== 



close 



cls05 
clslO 



a5 16 
dO Ob 
a9 00 
8d 46 43 
20 a4 ee 
4c d3 fO 

c9 Of 
fO Oc 
20 ba f5 

a5 16 
c9 02 
90 fO 
4c 9f db 



=> Close all <= 



Ida sa 
bne clslO 
Ida #$00 
sta dirlst 
jar frechn 
jmp freich 

cmp #15 
beq clsall 
jsr clschn 

Ida sa 
cmp #$02 
bcc cls05 
Jmp endcmd 



a9 Oe 
85 16 
20 ba f5 

c6 16 
10 f9 
4c 9f db 



clsall 



cls20 



Ida #14 
sta sa 
jsr clschn 

dec sa 
bpl cls20 
jmp endcmd 



a6 16 
b5 a2 
c9 ff 
dO 01 
60 

29 Of 
85 15 
20 a6 
c9 07 
fO Of 
c9 04 
fO 11 
20 89 ed 
bO 09 
20 12 f6 



ed 



05689 f5da 20 a4 f6 

05690 f5dd 20 55 f 6 



current secondary address 
=0 (LOAD flag)? 

directory listing flag 

Free channel associated with SA 

Free both internal channels 



yes: close all channels 

Close file virlth specified secondary 

address 

current secondary address 

load, save 

Terminate command successfully 



init counter for If 

current secondary address 

Close file vdth specified secondary 

address 

decrement counter 

while not negative 

Terminate command successfully 



==> Close file with specified S( 



clschn Idx sa 

Ida lintab.x 
cmp #$ff 
bne clsc28 
rts 

clsc28 and #$0f 
sta lindx 
jsr typfil 
cmp #dirtyp 
beq clsc30 
cmp #reltyp 
beq clsrel 
jsr fndwch 
bcs clsc31 
jsr clswrt 

jsr clsdir 
cl3c30 jsr mapout 



05691 f5e0 4c a4 ee clsc31 jmp frechn 



econdary address <== 

current secondary address 

channel allocated? 
yes 



mask channel 

logical index, channel number 
Get current file type 
direct access? 



Sub to close relative file 

Find the assigned write channel 

not a write file 

Close a sequential file write 

channel 

Close directory after writing file 

Write out BAM to drive specified in 

LSTJOB 

Free channel associated with SA 



close, open channels 



page ..120 



line addr object 



source code 



05692 


f5e3 












05693 


f5e3 












05694 


f5e3 


SESS 


=> Sub to close 


relative £ile 


05695 


f5e3 












05696 


£5e3 


20 


£1 


£8 


dsrel 


jsr scrub 


05697 


f5e6 


20 d6 eb 




jsr dblbuf 


05698 


f5e9 


20 


ae 


£c 




Jsr ssend 


05699 


f5ec 


a6 83 






Idx ssnuffl 


05700 


f5ee 


86 


08 






stx t4 


05701 


f5fO 


e6 


08 






inc t4 


05702 


f5f2 


a9 


00 






Ida #$00 


05703 


f5f4 


85 


05 






sta tl 


05704 


f5£6 


85 06 






sta t2 


05705 


f5f8 


a5 


84 






Ida sslnd 


05706 


fSfa 


38 








sec 


05707 


f5fb 


e9 


Oe 






sbc #ssiof £-2 


05708 


f5£d 


85 


07 






sta t3 


05709 


f5ff 


20 


53 


£a 




Jsr sscalc 


05710 


f602 


a6 


15 






Idx llndx 


05711 


f604 


a5 


05 






Ida tl 


05712 


f606 


95 


59 






sta nbkl,x 


05713 


f608 


a5 


06 






Ida t2 


05714 


f60a 


95 


61 






sta nbkh,x 


05715 


£60c 


20 


a4 £6 




Jsr clsdir 


05716 


f60f 












05717 


f60f 


4c 


a4 


ee 




Jmp £rechn 


05718 


f612 












05719 


£612 












05720 


£612 




=> Close 


a sequential £lle wr: 


05721 


£612 












05722 


£612 


a6 


15 




clswrt 


Idx lindx 


05723 


£614 


b5 


59 






Ida nbkl,x 


05724 


£616 


15 


61 






or a nbkh,x 


05725 


£618 


dO 


Oc 






bne clswlO 


05726 


£61 a 


20 


el 


£0 




Jsr getpnt 


05727 


£61 d 


c9 


02 






cmp #$02 


05728 


£61 f 


dO 


05 






bne clswlO 


05729 


£621 


a9 


Od 






Ida #cr 


05730 


£623 


20 


b6 


ec 




Jsr putbyt 


05731 


£626 


20 


el 


£0 


dswlO 


Jsr getpnt 


05732 


£629 


c9 


02 






cmp #$02 


05733 


£62b 


dO 


0£ 






bne clsw20 


05734 


£62d 


20 


d6 


eb 




Jsr dblbuf 


05735 


£630 


a6 


15 






Idx lindx 


05736 


£632 


b5 


59 






Ida nbkl.x 


05737 


£634 


dO 02 






bne clswlS 


05738 


£636 


d6 


61 






dec nbkh,x 


05739 


£638 


d6 


59 




clswlS 


dec nbkl.x 


05740 


f63a 


a9 


00 






Ida #$00 


05741 


£63c 


38 






clsw20 


sec 



Write out bu££er i£ dirty 

Double buffer: switch 

active/inactive buffers 

Set SS & BUFTAB to end of last 

record 

side sector number 



pointer to side sector value 

(end) pointer in side sector 

proceeding bytes 

how many ss blocks needed? 
logical index, channel number 

block count lo, channel 0-7 

block count hi, channel 0-7 

Close directory after writing file 

bit 6 in (90, x) set? 

Free channel associated with SA 



logical Index, channel number 
block count lo, channel 0-7 
block count hi, channel 0-7 
at least one block written 
Get the active buffer pointer 

at least one byte written 

Byte to active buffer of LINDEX 

channel 

Get the active buffer pointer 

not an empty buffer 

switch buffers 

logical index, channel number 

block count lo, channel 0-7 

decrement block count hi & lo 

block count hi, channel 0-7 

block count lo, channel 0-7 

calculate end pointer 



close, open channels 



page ..121 



line addr object source code 



05742 
05743 
05744 
05745 

05746 
05747 
05748 

05749 

05750 

05751 

05752 

05753 

05754 

05755 

05756 

05757 

05758 

05759 

05760 

05761 

05762 

05763 

05764 

05765 

05766 

05767 

05768 

05769 

05770 

05771 

05772 

05773 

05774 

05775 

05776 

05777 

05778 

05779 

05780 

05781 

05782 

05783 

05784 

05785 

05786 

05787 

05788 

05789 

05790 

05791 

05792 



f63d 
f63f 
f640 
f642 

f645 
f648 
f649 

f64c 

f64f 

f652 

f655 

f655 

£655 

£655 

£655 

£658 

£659 

£65c 

£65e 

£65f 

£660 

£662 

£664 

£667 

£669 

£66b 

£66d 

f66£ 

£671 

£671 

£671 

£671 

£671 

£673 

£674 

£675 

£676 

£678 

f67a 

£67b 

£67d 

£67£ 

£680 

£682 

£684 

£685 

£687 

£689 

£68c 

£68e 

£690 



e9 01 
48 

a9 00 
20 cl £0 

20 b6 ec 

68 

20 b6 ec 

20 4a ed 
20 87 ec 
4c d6 eb 



sbc #$01 

pha 

Ida #$00 

jar setpnt 

jsr putbyt 

pla 

jsr putbyt 

jsr wrtbuf 
jsr watjob 
jmp dblbuf 



back up one 

buf£er pointer = 

Set up pointer into active data 

buffer 

last character count 

Byte to active buffer of LINDEX 

channel 

write out last buffer 

Wait until job is completed 

make sure both buffers are OK 



===> Write out BAM to drive specified in LSTJOB <= 



20 95 fa 



43 



bd 4e 
29 01 
48 
aa 

a9 00 
85 14 
bd e8 d2 
85 09 
a9 00 
85 08 
a9 01 
85 13 



mapout jsr getact 
tax 
Ida 1st job, X 

iiiolO and #$01 
pha 
tax 

Ida #$00 
sta sector 
Ida ipbm,x 
sta teBip+5 
Ida #$00 
sta t4 
Ida #$01 
sta track 



Get active buffer number 
last job by buffer 
check BAM before writing 



current sector number 
BAM address hi 



current track number 






Verify that BAM block count matches the bits <== 



a5 13 

Oa 

Oa 

a8 

bl 08 

85 07 

c8 

bl 08 

85 04 

c8 

bl 08 

85 05 

c8 

bl 08 

85 06 

20 bd d7 

e6 13 

a5 13 

c9 24 



mapchk Ida 
asl 
asl 
tay 
Ida 
sta 
iny 
Ida 
sta 
iny 
Ida 
sta 
iny 
Ida 
sta 
Jsr 
inc 
Ida 
cmp 



track 
a 



(t4).y 
t3 

(t4),y 

to 

(t4),y 
tl 

(t4),y 

t2 

avck 

track 

track 

#maxtrk 



current track number 



temporary work area 



check bit map validity 

next track 

current track number 



close, open channels 



page ..122 



line 


addr 


object 




source code 




05793 


f692 


dO dd 




bne mapchk 


verify that BAM block count i 
the bits 


05794 


f694 


a9 12 




Ida #18 




05795 


f696 


85 13 




sta track 


current track number 


05796 


f698 


68 




pla 




05797 


f699 


a8 




tay 




05798 


f69a 


18 




clc 




05799 


f69b 


69 Oc 




adc Ibamjob 




05800 


f69d 


aa 




tax 




05801 


f69e 


98 




tya 




05802 


f69f 


09 W 




ora #write 




05803 


f6al 


4c 9d 


fl 


Jmp doit 


Do job, set up error count ar 
if error returns 


05804 


f6a4 










05805 


f6a4 










05806 


f6a4 


=> Close directory after writing 


file <= 


05807 


£6a4 










05808 


f6a4 


a6 15 




clsdir Idx lindx 


save logical index 


05809 


f6a6 


8e 75 


43 


stx wlindx 




05810 


£6a9 


a5 16 




Ida sa 


current secondary address 


05811 


f6ab 


48 




pha 




05812 


f6ac 


bd 6b 43 


Ida dirent,x 


get directory sector 


05813 


f6af 


48 




pha 




05814 


f6bO 


29 If 




and #$lf 




05815 


f6b2 


85 14 




sta sector 


current sector number 


05816 


f6b4 


68 




pla 




05817 


f6b5 


29 eO 




and #$eO 


get sector offset 


05818 


£6b7 


09 02 




ora #$02 




05819 


f6b9 


8d 9a 


43 


sta index 


current index in buffer 


05820 


f6bc 


b5 90 




Ida filtyp.x 


drive number in FILTYP 


05821 


f6be 


29 01 




and #$01 




05822 


f6cO 


85 12 




sta drvnuni 


current drive# 


05823 


f6c2 


a9 12 




Ida #18 




05824 


f6c4 


85 13 




sta track 


current track number 


05825 


£6c6 


20 95 


fa 


jsr getact 


allocate a buffer 


05826 


f6c9 


48 




pha 




05827 


f6ca 


85 al 




sta Jobnum 


current job number 


05828 


£6cc 


20 57 


fO 


Jsr drtrd 


read directory sector 


05829 


f6cf 


aO 00 




Idy #$00 




05830 


f6dl 


bd f f 


fO 


Ida bufind.x 


.X is job 


05831 


f6d4 


85 la 




sta rOt-l 




05832 


f6d6 


ad 9a 


43 


Ida index 


copy lo byte of pointer into 
directory buffer 


05833 


f6d9 


85 19 




sta rO 




05834 


f6db 


bl 19 




Ida (rO),y 


file type 


05835 


f6dd 


29 20 




and #$20 


file closed? 


05836 


f6df 


fO 41 




beq clsd5 


not a replace file if zero 


05837 


f6et 


20 a6 


ed 


jsr typfil 


Get current file type 


05838 


f6e4 


fO 44 




beq clsd6 




05839 


f6e6 


bl 19 




Ida (r0),y 


temporary result 


05840 


f6e8 


29 8f 




and #$8f 


mask off replace bit 


05841 


£6ea 


91 19 




sta (rO),y 




05842 


f6ec 


c8 




iny 


point to old track link 



close, open channels 



page ..123 



line addr object source code 



05843 f6ed bl 19 

05844 f6ef 85 13 

05845 f6fl 84 06 

05846 f6f3 aO lb 

05847 f6£5 bl 19 

05848 f6f7 48 

05849 f6f8 88 

05850 f6f9 bl 19 

05851 f6fb dO Oa 



05852 

05853 

05854 

05855 

05856 

05857 

05858 

05859 

05860 

05861 

05862 

05863 

05864 

05865 

05866 

05867 

05868 

05869 

05870 

05871 

05872 

05873 

05874 

05875 

05876 

05877 

05878 

05879 

05880 

05881 

05882 

05883 

05884 

05885 

05886 

05887 

05888 



f6fd 

f6ff 

£700 

f702 

f704 

£707 

£708 

f70a 

£70c 

f70d 

£70f 

£710 

£712 

£714 

£715 

£717 

£719 

f71a 

£71c 

£71 f 

£722 

£722 

£724 

£726 

£728 

£72a 

f72d 

£72£ 

£731 

£733 

£734 

£736 

£738 

£739 

£73a 

£73c 

f73e 



85 13 

68 

85 14 

a9 67 

20 5c d9 

48 

a9 00 

91 19 

c8 

91 19 

68 

a4 06 

91 19 

c8 

bl 19 

85 14 

68 

91 19 

20 Id e3 

4c 2a £7 

bl 19 
29 Of 
09 80 
91 19 
ae 75 43 
aO Ic 
b5 59 
91 19 
c8 

b5 61 
91 19 
68 
aa 

a9 90 
05 12 
20 9d £1 



Ida (r0),y 

ata track 

sty t2 

Idy #27 

Ida (r0),y 

pha 

dey 

Ida (rO),y 

bne clsd4 

sta track 
pla 

sta sector 
Ida #$67 
jar cnider2 
clsd4 pha 



Ida 
sta 
Iny 
sta 
pla 
Idy 
sta 
iny 
Ida 
sta 
pla 
sta 
jsr 
jmp 



#$00 
(r0),y 

(rO),y 

t2 
(rO).y 

(rO),y 
sector 

(rO).y 
del£il 
clsd6 



clsd5 



clsd6 



05889 £741 68 

05890 £742 85 16 

05891 £744 4c 89 ed 

05892 £747 

05893 £747 



Ida (rO),y 

and #$0f 

ora #$80 

sta (r0),y 

Idx wllndx 

Idy #28 

Ida nbkl.x 

sta (r0),y 

iny 

Ida nbkh,x 

sta (rO),y 

pla 

tax 

Ida #write 

ora drvnum 

jsr doit 

pla 

sta sa 
jmp fndwch 



copy it 

current track number 

extract replacement link 
to last sector 



replacement track link 

i£ not zero — or we're in trouble, 

so 

put replacement track link in TRACK 

replacement sector link 

current sector number 

track or sector error 

replacement track link 

clear t&s link to replacement £ile 

at pos. 26 & 27 
temporary result 

original pointer value 
temporary result 
and insert at pos. 1 & 2 
move old sector link 

replacement now becomes 
final sector link 
scratch replaced file 
finish closing 

file type 

mask bits 0-3 

set bit 7 (close bit) 

store type 

active buffer number 

set number of blocks 

block count lo 

at position 28 (count lo) 

and hi at 29 

block count hi, channel 0-7 

temporary result 

buffer number 

write directory sector 

Do job, set up error count and exit 

if error returns 

restore 

current secondary address 

Find the assigned write channel 



close, open channels 



page . . 1 24 



line 


addr 


object 




source code 




05894 


f747 


=.=> Open 


a read 


channel with two 


buf £ers <== 


05895 


f747 














05896 


£747 


a9 02 




opnrch Ida #$02 


number o£ blocks to allocate 


05897 


f749 


20 63 


ee 




jsr 


getrch 


Open a new read channel 


05898 


f74c 


20 b4 


£7 




Jar 


Intpnt 


Initialize variables for open 
channel 


05899 


f74f 


a5 c5 






Ida 


type 


current file type 


05900 


f751 


48 






pha 






05901 


f752 


Oa 






asl 


a 


set file type flags 


05902 


£753 


05 12 






ora 


drvnum 




05903 


£755 


95 90 






sta 


£iltyp,x 




05904 


£757 


20 22 


ed 




Jsr 


strdbl 


Start double buffering (reading 
ahead) 


05905 


f75a 


a6 15 






Idx 


lindx 


logical index, channel number 


05906 


f75c 


a5 13 






Ida 


track 


current track number 


05907 


£75e 


dO 04 






bne 


or 10 




05908 


£760 


a5 14 






Ida 


sector 


current sector number 


05909 


£762 


95 bd 






sta 


lstchr,x 


use sector link as end pointer 


05910 


£764 


68 




orlO 


pla 




file type 


05911 


£765 


c9 04 






cmp 


#reltyp 




05912 


£767 


dO 3£ 






bne or30 




05913 


£769 


a4 16 






Idy 


sa 


current secondary address 


05914 


£76b 


b9 a2 


00 




Ida 


lintab.y 


set channel as 


05915 


f76e 


09 40 






ora 


#$40 


read/write 


05916 


£770 


99 a2 00 




sta 


llntab.y 




05917 


£773 


ad 4b 43 




Ida 


rec 


record size 


05918 


£776 


95 71 






sta 


rs.x 


record sizes table 


05919 


£778 


20 03 


ef 




jsr 


getbuf 


Get a free buffer 


05920 


£77b 


10 03 






bpl 


or20 


found buffer for side sector? 


05921 


£77d 


4c 8c 


ee 




jmp gberr 


nope 


05922 


£780 














05923 


£780 


a6 15 




or20 


Idx 


lindx 


logical index, channel number 


05924 


£782 


95 79 






sta 


ss,x 


side sectors table 


05925 


£784 


ac 4c 


43 




Idy 


trkss 


copy side sector track link 


05926 


£787 


84 13 






sty 


track 


current track number 


05927 


£789 


ac 4d 


43 




Idy 


secss 


copy side sector sector link 


05928 


£78c 


84 14 






sty 


sector 


current sector number 


05929 


f78e 


20 97 


ec 




jsr 


seth 


set SS header 


05930 


£791 


20 75 


£9 




Jsr 


rdss 


read it in 


05931 


£794 


20 87 


ec 




jsr 


watjob 


Wait until job is completed 


05932 


£797 


a6 15 




orow 


Idx 


lindx 


logical index, channel number 


05933 


£799 


a9 02 






Ida #$02 




05934 


£79b 


95 69 






sta 


nr,x 


pointer for write set for next 
record 


05935 


£79d 


a9 00 






Ida #$00 


buffer pointer = 


05936 


£79£ 


20 cl 


£0 




jsr 


setpnt 


Set up pointer into active data 
buffer 


05937 


f7a2 


20 39 


£c 




jsr 


rd40 


set op first record 


05938 


f7a5 


4c 3e 


£9 




jmp gethdr 


restore track & sector 


05939 


f7a8 














05940 


£7a8 












sequential set up 


05941 


£7a8 


20 d7 


ed 


or 30 


Jsr 


rdbyt 


Read byte from file 


05942 


f7ab 


a6 15 






Idx 


lindx 


side sector buffer 



close, open channels 



page ..125 



line addr object 



source code 



05943 

05944 

05945 

05946 

05947 

05948 

05949 

05950 

05951 

05952 

05953 

05954 

05955 

05956 

05957 

05958 

05959 

05960 

05961 

05962 

05963 

05964 

05965 

05966 

05967 

05968 

05969 

05970 

05971 

05972 

05973 

05974 

05975 

05976 

05977 

05978 

05979 

05980 

05981 

05982 

05983 

05984 

05985 
05986 
05987 
05988 
05989 
05990 
05991 
05992 
05993 
05994 



f7ad 

f7af 

f7bl 

f7b3 

f7b4 

f7b4 

f7b4 

f7b4 

f7b4 

f7b6 

f7b8 

f7ba 

f7bd 

f7bf 

f7c2 

f7c5 

f7c7 

f7c8 

f7c9 

f7cb 

f7ce 

f7d0 

f7d2 

f7d4 

f7d5 

f7d6 

f7d8 

£7db 

f7dd 

f7df 

f7el 

f7e3 

f7e5 

f7e6 

£7e6 

f7e6 

f7e6 

f7e6 

f7e9 

f7eb 

f7ee 

f7fl 

f7f4 
f7f6 
f7f8 
f7f9 
f7fa 
f7fc 
f7fe 
£7ff 
£801 
£803 



95 b5 
a9 88 
95 98 
60 



sta chndat.x 
Ida #rdytlk 
sta chnrdy.x 
rts 



channel data byte 

set READ £lag, reset EDI 

channel status 



=> Initialize variables £or open channel <= 



a6 15 
a5 12 
b4 49 . 
99 4e 43 
b4 51 
99 4e 43 
99 03 10 
b5 49 
Oa 
aS 

a9 02 
99 29 00 
b5 51 
09 80 
95 51 
Oa 
a8 

a9 02 
99 29 00 
a9 00 
95 59 
95 61 
a9 00 
95 bd 
60 



intpnt Idx 
Ida 
Idy 
sta 
Idy 
sta 
sta 
Ida 
asl 
tay 
Ida 
sta 
Ida 
ora 
sta 
asl 
tay 
Ida 
sta 
Ida 
sta 
sta 
Ida 
sta 
rts 



lindx 

drvnum 

bufO.x 

1st job, y 

bu£l,x 

1st job, y 

jobs.y 

bu£0,x 

a 

#$02 

bu£tab,y 

bu£t,x 

#$80 

bufl,x 

a 

#$02 

buftab,y 

#$00 

nbkl,x 

nbkh,x 

#$00 

Istchr.x 



logical index, channel number 

current drivel 

channel bu£fer table 1 

last job by bu££er 

channel bu££er table 2 

last Job by bu£fer 

queue 

channel buf£er table 1 

tst bu£ times 2 

= pointer in buf£er pointer table 

pointer lo in 

bu£fer pointer lo 

channel buf£er table 2 

set bit 7 (buffer not active) 

channel buffer table 2 

2nd buf times 2 

= pointer 

buffer pointer lo 

block count lo, channel 0-7 
block count hi, channel 0-7 

channel last character pointer 



=> Open a write channel with two buffers <=== 



20 47 d7 opnwch jsr intts 

a9 02 Ida #$02 

20 60 ee jsr getwch 

20 94 ec jsr sethdr 

20 b4 f7 jsr intpnt 

a6 15 Idx lindx 

a5 c5 Ida type 

48 pha 

Oa asl a 

05 12 ora drvnum 

95 90 sta filtyp,x 

68 pla 

c9 04 cmp #reltyp 

fO 05 beq owlO 

a9 01 Ida #rdylst 



get first track and sector 

number of buffers 

Open a new write channel 

Set up header for active buffer 

Initialize variables for open 

channel 

logical index, channel number 

current file type 

bit shift left 
current drive# 
file type flags, channel 0-7 

REL? 

active listener 



close, open channels 



page ..126 



line addr object 



source code 



05995 
05996 
05997 
05998 
05999 
06000 
06001 
06002 
06003 
06004 
06005 
06006 
06007 
06008 
06009 
06010 
06011 
06012 
06013 
06014 
06015 
06016 
06017 
06018 
06019 
06020 
06021 

06022 
06023 
06024 
06025 
06026 
06027 
06028 
06029 
06030 
06031 
06032 
06033 
06034 
06035 

06036 
06037 
06038 
06039 
06040 
06041 
06042 
06043 
06044 



f805 
f807 
£808 
£808 
f80a 
fSOd 
fSOf 
£811 
£814 
£817 
£819 
fSlc 
f81e 
£821 
£821 
£823 
£825 
£828 
f82b 
£82d 
£830 
£832 
£835 
£837 
£839 
f83c 
f83e 

£841 
£843 
£846 
£848 
£84b 
f84d 
£850 
£853 
£856 
£858 
£85b 
£85d 
£860 
£862 

£865 
£868 
£86a 
£86d 
£86£ 
£872 
£875 
£878 
£87a 



95 98 
60 

a4 16 
b9 a2 00 
29 3f 

09 40 

99 a2 00 
ad 4b 43 
95 71 
20 03 ef 

10 03 

4c 8c ee 

a6 15 
95 79 
20 c3 £9 
20 bO d6 
a5 13 
8d 4c 43 
a5 14 
8d 4d 43 
a6 15 
b5 79 
20 97 ec 
a9 00 
20 eb £9 



owlO 



£8 



£8 



a9 00 
20 95 
a9 11 
20 95 
a9 00 
20 95 £8 
ad 4b 43 
20 95 £8 
a5 13 
20 95 £8 
a5 14 
20 95 £8 
a9 10 
20 eb £9 

20 3e £9 
a5 13 

20 95 £8 
a5 14 

20 95 £8 

20 6e £9 

20 87 ec 
a9 02 

20 cl £0 



ow20 



sta chnrdy,x 
rts 

Idy sa 

Ida llntab,y 
and #$3£ 
ora #$40 
sta llntab.y 
Ida rec 
sta rs,x 
Jsr getbu£ 
bpl ow20 
jmp gberr 

Idx llndx 
sta ss,x 
jsr clrbuf 
jsr nxtts 
Ida track 
sta trkss 
Ida sector 
sta secss 
Idx lindx 
Ida ss,x 
jsr seth 
Ida #$00 
Jsr setssp 

Ida #$00 
jsr putss 
Ida #sslo££+l 
jsr putss 
Ida #$00 
jsr putss 
Ida rec 
jsr putss 
Ida track 
jsr putss 
Ida sector 
jsr putss 
Ida #sslo£f 
jsr setssp 

jsr gethdr 
Ida track 
jsr putss 
Ida sector 
jsr putss 
Jsr wrtss 
jsr watjob 
Ida #$02 
Jsr setpnt 



channel status 



current secondary address 

reset bits 6 & 7 
set bit 6 (R/W flag) 

record size 
record sizes table 
Get a free buffer 

no buffer 

logical index, channel number 

side sectors table 

zeroize buffer 

Next available track and sector 

current track number 

side sector track number 

current sector number 

side sector sector number 

logical index, channel number 

side sectors table 

get track & sector of first SS 

buffer pointer 

Use SS pointer to set DIRBUF 

& BUFTAB 

set null link 

put byte into side sector 

set last character 

put byte into side sector 

number of side sector 

put byte into side sector 

record size 

put byte into side sector 

current track number 

put byte into side sector 

current sector number 

put byte into aide sector 

buffer pointer 

Use SS pointer to set DIRBUF 

& BUFTAB 

get first track/sector 

current track number 

put byte into side sector 

current sector number 

put byte into side sector 

write it out 

Wait until job is completed 

buffer pointer 

Set up pointer into active data 

buffer 



close, open channels 



page ..127 



line addr object 



source code 



06045 
06046 
06047 
06048 
06049 
06050 
06051 

06052 
06053 
06054 
06055 
06056 
06057 
06058 
06059 
06060 
06061 
06062 
06062 
06063 



f87d 
f87f 
£880 
f882 
f884 
£886 
£889 

f88c 
£88f 
£892 
£895 
£895 
£895 
£895 
£895 
£896 
£898 
£89a 
f89d 
f89d 



a6 15 
38 

a9 00 
£5 71 
95 69 
20 ca £d 
20 19 £9 

20 60 £9 
20 87 ec 
4c 97 £7 



Idx lindx 

sec 

Ida #$00 

sbc rs,x 

sta nr,x 

jsr nulbu£ 

jsr nullnk 

jsr wrtout 
jsr watjob 
jmp orow 



==> Put byte into side sector <= 



48 

a6 15 
b5 79 
4c c2 ec 



putss 



pha 

Idx lindx 
Ida ss,x 
Jmp putbl 

•lib tst£lg 



logical index, channel number 

length of record 

record sizes table 

next record pointers table 

Set null records in active bu££er 

Set track link to 0, sector link to 

last non-0 char in buf 

store write job code 

Wait until job is completed 

finish opening channel 



data 

active buffer number 

side sector buffer number 



tstflg, ssutil, getact, rell, nxtrec 



page ,.128 



line 


addr 


object 


source 


code 




06065 


f89d 


==> Set, 


clear and test flags <= 


=3 


06066 


f89d 










06067 


f89d 


90 06 


acflg 


bcc clrflg 


Clear flag 


06068 


£89f 










06069 


f89f 










06070 


f89f 


=> Set buffer pointers <=» 




06071 


f89f 










06072 


f89f 


a6 15 


setflg 


Idx lindx 


logical index, channel number 


06073 


fSal 


15 90 




ora filtyp.x 


set flag 


06074 


f8a3 


dO 06 




bne clrflO 


always 


06075 


f8a5 










06076 


f8a5 










06077 


£8a5 


==> Clear flag <= 


SS3=S 




06078 


f8a5 










06079 


f8a5 


a6 15 


drflg 


Idx lindx 


logical index, channel number 


06080 


f8a7 


49 f f 




eor #$ff 


clear flag by flipping the bits 


06081 


f8a9 


35 90 




and filtyp.x 


file type flags, channel 0-7 


06082 


fSab 


95 90 


clrflO 


sta filtyp.x 




06083 


fSad 


60 




rts 




06084 


f8ae 










06085 


fSae 










06086 


f8ae 


==> Test flag <= 


= 




06087 


f8ae 










06088 


f8ae 


a6 15 


tstflg 


Idx lindx 


logical index, channel number 


06089 


f8b0 


35 90 




and filtyp.x 




06090 


f8b2 


60 




rts 




06091 


f8b3 










06092 


f8b3 










06093 


f8b3 


===> Test 


if this 


is a write job 


<= 


06094 


f8b3 










06095 


f8b3 


20 95 fa 


tstwrt 


jsr getact 


Get active buffer number 


06096 


f8b6 


aa 




tax 




06097 


f8b7 


bd 4e 43 




Ida 1st job, X 


last job code. 


06098 


f8ba 


29 £0 




and #$fO 


mask off the drive bits to see if it 

is a 

write job. If so, this sets the Z 


06099 


fSbc 


c9 90 




cmp #$90 












flag 


06100 


f8be 


60 




rts 




06101 


f8bf 










06102 


fSbf 










06103 


£8bf 


=> Test 


for active files <== 




06104 


f8bf 


C=0 


if file 


active X=ENTFND, 


y=LINDEX 


06105 


f8bf 


Ol 


if file 


inactive X=18 




06106 


fSbf 










06107 


f8bf 


a2 00 


tstchn Idx #$00 


start search at top 


06108 


f8cl 


86 06 


tstc20 


stx t2 


save to look on 


06109 


f8c3 


b5 a2 




Ida lintab.x 


current status 


06110 


f8c5 


c9 ff 




cmp #$ff 


channel allocated? 


06111 


f8c7 


dO 08 




bne tstc40 


if plus, then test it 


06112 


f8c9 


a6 06 


tstc30 


1 Idx t2 


not active 


06113 


fScb 


e8 




inx 


increment counter 


06114 


fScc 


eO 14 




cpx #maxsa+2 


and continue search while <16 


06115 


f8ce 


90 £1 




bcc tstc20 


searched all 



tstflg, ssutll, getact, rell, nxtrec 



page ..129 



line addr object source code 



06116 

06117 

06118 

06119 

06120 

06121 

06122 

06123 

06124 

06125 

06126 

06127 

06128 

06129 

06130 

06131 

06132 

06133 

06134 

06135 

06136 

06137 

06138 

06139 

06140 

06141 

06142 

06143 

06144 

06145 

06146 

06147 

06148 

06149 

06150 

06151 

06152 

06153 

06154 

06155 

06156 

06157 

06158 

06159 

06160 

06161 

06162 

06163 

06164 

06165 

06166 

06167 



fSdO 
f8dl 
fSdl 
f8d3 
f8d5 
f8d6 
f8d9 
fSdb 
f8dd 
f8eO 
f8e2 
f8e4 
f8e6 
f8e8 
fSeb 
fSed 
f8ef 

fSfO 

f8fl 

f8fl 

fSfl 

fSfl 

f8fl 

f8fl 

f8fl 

f8f4 

f8f6 

f8f9 

f8fc 

fSfd 

f8fd 

f8fd 

f8fd 

fSfd 

f900 

f902 

f904 

f905 

f907 

f909 

f90c 

f90c 

f90c 

f90c 

f90c 

f90f 

f911 

f913 

£914 

f916 

f918 

f919 



60 

86 06 
29 3f 
a8 

b9 90 00 
29 01 
85 05 
ae 45 43 
b5 8b 
29 01 
c5 05 
dO el 
b9 6b 43 
d5 86 
dO da 
18 

60 



rts 

tstc40 stx 
and 
tay 
Ida 
and 
sta 
Idx 
Ida 
and 
cmp 
bne 
Ida 
cmp 
bne 
clc 

rts 



t2 
#$3f 

filtyp.y 

#$01 

tl 

entfnd 

flldat.x 

#$01 

tl 

tstc30 

dirent.y 

filent.x 

tstc30 



yes. If none found, carry = 1 



mask channel, drive number 

use UNDX as index 
mask off non-drive bits 

entry found index 

drive number for this entry 

mask off non-drive bits and see if 

the drives match 

now check if the directory sectors 

are match 

if they are, 

flag all tests passed and active 

file found, 

so return with carry = 



===> Write out buffer if dirty <=== 

A buffer is "dirty" if the copy in RAM has been modified 
so it does not match the copy on disk 



20 aO fa 
50 06 
20 60 f9 
20 87 ec 
60 



scrub 



scrl 



jsr gaflgs 
bvc scrl 
jsr wrtout 
jsr watjob 
rts 



Get active buffer 

not dirty 

write it out 

Wait until job is completed 



==> Put TRACK & SECTOR into buffer <== 



20 2b f9 setlnk jsr setOO 

a5 13 Ida track 

91 27 sta (dirbuf),y 

c8 iny 

a5 14 Ida sector 

91 27 sta (dirbuf),y 

4c eb fb jmp sdirty 



Set up pointer to active buffer 
current track number 
directory buffer pointer 

current sector number 
directory buffer pointer 
Set buffer dirty flag 



=> Set TRACK & SECTOR from link in buffer <= 



20 2b f9 
bl 27 
85 13 
c8 

bl 27 
85 14 
60 



getlnk jsr setOO 

Ida (dirbuf),y 

sta track 

iny 

Ida (dirbuf),y 

sta sector 

rts 



Set up pointer to active buffer 

move the track link to 

current track number 

and 

the sector link to 

current sector number 



tstflg, ssutil, getact, rell, nxtrec 



page ..130 



line addr object 



source code 



06168 
06169 
06170 
06171 
06172 
06173 
06174 
06175 

06176 
06177 
06178 
06179 

06180 
06181 
06182 
06183 
06184 
06185 
06186 
06187 

06188 
06189 

06190 
06191 
06192 
06193 
06194 
06195 
06196 
06197 
06198 
06199 
06200 
06201 
06202 
06203 
06204 
06205 
06206 
06207 
06208 
06209 
06210 
06211 
06212 
06213 



f919 
f919 
f919 
f919 
£91 c 
f91e 
f920 
f921 

f923 
f925 
f926 
f927 

f928 
f92a 
f92b 
f92b 
£92b 
f92b 
f92b 
f92e 

f92f 
£930 

£932 
£934 
£936 
£938 
£93a 
£93b 
f93b 
£93b 
£93b 
£93b 
f93e 
£941 
£943 
£944 
£945 
£946 
£947 
£94a 
£94c 
£94£ 
£951 
£952 
£952 
£952 



==> Set track link to 0, sector link to last non-0 char in bu£ <=== 

20 2b £9 nullnk jsr setOO Set up pointer to active bu££er 

a9 00 Ida #$00 store $00 as 

91 27 sta (dirbuf),y track link, 

c8 iny then 

a6 15 Idx lindx get the active bu£fer number, load 

the 

b5 69 Ida nr,x next record pointers table 

aa tax and, a£ter 

ca dex subtracting 1 , 

8a txa store the result as the sector link 

in the 

91 27 sta (dirbuf),y directory bu£fer. 

60 rts 



=> Set up pointer to active bu££er <= 



20 95 £a setOO jsr getact 

Oa asl a 

aa tax 

b5 2a Ida bu£tab+l,x 

85 28 sta dirbuf+1 

a9 00 Ida #$00 

85 27 sta dirbu£ 

aO 00 Idy #$00 

60 rts 



Get active bu££er number 
multiplied by 2: pointer in bu££er 
pointer table 

move the hi byte of the bu££er 

pointer 

to the directory buffer 

and use $00 as 

lo byte 



==> Set TRACK & SECTOR from header <-=- 



20 6e ed 

20 95 fa 

85 al 

Oa 

Oa 

Oa 

aS 

b9 23 10 

85 13 

b9 24 10 

85 14 

60 



curblk jsr 
gethdr jsr 
sta 
asl 
asl 
asl 
tay 
Ida 
sta 
Ida 
sta 
rts 



fndrch 
getact 
jobnum 



hdrs+2,y 
track 
hdrs+3,y 
sector 



Find an unused channel 
Get active buffer number 

multiply 

it 

by 8, 

so it points to the range we want. 

Now we first move the 

current track number 

and then the 

current sector number 



tstflg, ssutil, getact, rell, nxtrec 



page .,131 



line addr object source code 



06214 

06215 

06216 

06217 

06218 

06219 

06220 

06221 

06222 

06223 

06224 

06225 

06226 

06227 

06228 

06229 

06230 

06231 

06232 

06233 

06234 

06235 

06236 

06237 

06238 

06239 

06240 

06241 

06242 

06243 

06244 

06245 

06246 

06247 

06248 

06249 

06250 

06251 

06252 

06253 

06254 

06255 

06256 
06257 
06258 
06259 
06260 
06261 
06262 
06263 
06264 
06265 



f952 

f952 

f952 

£954 

f957 

£959 

£959 

£959 

£959 

£959 

£95b 

£95e 

£960 

£960 

£960 

£960 

£960 

£962 

£965 

£967 

£967 

£967 

£967 

£967 

£969 

£96c 

f96e 

f96e 

£96e 

£96e 

£96e 

£970 

£973 

£975 

£975 

£975 

£975 

£975 

£977 

f97a 

£97c 

£97e 

£97f 
£981 
£984 
£987 
£988 
£98a 
£98d 
£990 
£993 
£994 



===> Do read and write jobs <== 



a9 90 
8d 3c 43 
dO 28 



wrtab Ida #write 
sta cffld 
bne sjlO 



=> Store read job code $80 <= 



a9 80 
8d 3c 43 
dO 21 



rdab 



Ida #read 
sta cmd 
bne sjlO • 



===> Store write job code $90 <= 

a9 90 wrtout Ida #write 
8d 3c 43 sta cmd 
dO 26 bne sj20 



===> Store read job code $80 <= 



a9 80 
8d 3c 43 
dO 1£ 



rdin 



Ida #read 
sta cmd 
bne sj20 



==> Write job code $90 <== 

a9 90 wrtss Ida #write 
8d 3c 43 sta cmd 
dO 02 bne rds5 



===> Store read job code $80 <= 



a9 80 
8d 3c 43 
a6 15 
b5 79 
aa 

10 13 

20 94 ec 

20 95 £a 

aa 

a5 12 

9d 4e 43 

20 £6 £b 

20 95 fa 

aa 

4c Oe £1 



rdss 
rds5 



SjlO 



sj20 



sj30 



Ida #read 
sta cmd 
Idx lindx 
Ida ss,x 
tax 

bpl sj30 

jsr sethdr 

jsr getact 

tax 

Ida drvnum 

sta 1st job, X 

jsr cdirty 

jsr getact 

tax 

jmp setljb 



temporary job command 
always 



temporary job command 
always 



temporary job command 



temporary job command 



temporary job command 



temporary job command 

logical index, channel number 

side sectors table 

i£ the resulting bu££er number is 

less 

than 127, branch, else 

Set up header £or active bu££er 

Get active buffer number 

current drive number 
last job by buffer 
Clear buffer dirty flag 
Get active buffer number 

Set up job using last job's drive 



tstflg, ssutil, getact, rell, nxtrec 



page ..132 



line addr object 



source code 



06266 
06267 
06268 
06269 
06270 
06271 



f997 
f997 
£997 
f997 
£997 
£999 



=> Set TRACK & SECTOR from link in buffer <= 



a9 00 
20 cl £0 



06272 £99c 20 b8 ed 



06273 
06274 
06275 
06276 
06277 
06278 
06279 
06280 
06281 
06282 
06283 
06284 
06285 
06286 
06287 
06288 
06289 
06290 
06291 
06292 
06293 
06294 
06295 
06296 
06297 
06298 
06299 
06300 
06301 
06302 
06303 
06304 
06305 
06306 
06307 
06308 
06309 
06310 
06311 
06312 
06313 
06314 
06315 
06316 



f99f 
f9al 
f9a4 
f9a6 
£9a7 
f9a7 
f9a7 
f9a7 
f9a7 
f9a7 
f9a7 
f9a7 
£9a8 
f9aa 
f9ac 
f9ae 
£9bl 
f9b3 
£9b6 
f9b8 
f9b9 
f9ba 
f9bb 
f9bd 
f9bf 
f9cO 
f9c2 
£9c3 
f9c3 
£9c3 
f9c3 
f9c3 
f9c4 
£9c7 
f9c9 
f9cb 
f9cd 
f9ce 
f9dO 
f9dl 
f9d3 
f9d4 
f9d4 
£9d4 



85 13 
20 b8 ed 
85 14 
60 



rdlnk Ida #$00 

jsr setpnt 

jsr getbyt 

sta track 
jsr getbyt 
sta sector 
rts 



Set up pointer into active data 

buffer 

Read one byte from the active buffer 

as the 

current track number 

and the next as the 

current sector number 



=> Move bytes between buffers <== 

On entry, .A holds the number of bytes to move, 
.Y the source buffer number 
.X the destination buffer number 



48 

a9 00 

85 04 

85 06 

b9 ff fO 

85 05 

bd ff fO 

85 07 

68 

a8 

88 

bl 04 

91 06 

88 

10 f9 

60 



bOtobO pha 
Ida 
sta 
sta 
Ida 
sta 
Ida 
sta 
pla 
tay 
dey 
Ida 
sta 
dey 
bpl 
rts 



b02 



#$00 

to 

t2 

bufind,y 

tl 

bufind,x 

t3 



(tO).y 
(t2),y 



temporary work area 

buffer (Y) hi 

buffer (X) hi 

use 'number of bytes to move' 

as a 

count down index 

temporary work area 



b02 



=> Clear buffer <= 



a8 

b9 ff fO 

85 05 

a9 00 

85 04 

a8 

91 04 

c8 

dO fb 

60 



drbuf tay 



cblO 



Ida bufind,y 

sta tl 

Ida #$00 

sta to 

tay 

sta (t0),y 

iny 

bne cblO 

rts 



buffer number hi address 



temporary work area 

temporary work area 

loop to fill buffers with zeros 



tstflg, ssutil, getact, rell , nxtrec 



page ..133 



line addr object source code 



06317 

06318 

06319 

06320 

06321 

06322 

06323 

06324 

06325 

06326 

06327 

06328 

06329 

06330 

06331 

06332 

06333 

06334 

06335 

06336 

06337 

06338 

06339 

06340 

06341 

06342 

06343 

06344 

06345 
06346 
06347 
06348 
06349 
06350 
06351 
06352 
06353 
06354 

06355 
06356 

06357 
06358 
06359 
06360 
06361 
06362 

06363 
06364 
06365 



f9d4 

f9d4 

f9d4 

f9d6 

f9d9 

f9db 

f9dd 

f9de 

f9de 

f9de 

f9de 

f9de 

f9e0 

f9e2 

f9e4 

f9e5 

f9e8 

f9ea 

f9eb 

f9eb 

f9eb 

f9eb 

f9eb 

f9ec 

f9ef 

f9f0 

f9fl 

f9f2 

f9f3 
f9f4 
f9f6 
f9f7 
f9f9 
f9fa 
f9fa 
f9fa 
f9fa 
f9£a 

f9fd 
f9ff 

faOl 
fa03 
fa05 
fa08 
faOb 
faOd 

falO 
fal3 
fal4 



=> Set side sector pointers to <= 



a9 00 
20 de f9 
aO 02 
bl 27 
60 



ssset 



Ida #$00 
jsr ssdir 
Idy #$02 
Ida (dirbuf),y 
rts 



Use SS pointer to set DIRBUF 
directory buffer pointer 



===> Use SS pointer to set DIRBUF <== (.A = lo byte) 



85 27 
a6 15 
b5 79 
aa 

bd ff 
85 28 
60 



ssdir 



fO 



sta dirbuf 

Idx lindx 

Ida ss,x 

tax 

Ida bufind.x 

sta dirbuf+1 

rts 



directory buffer pointer 
the active buffer number 
side sectors table 

buffer address hi 
buffer pointer hi 



===> Use SS pointer to set DIRBUF & BUFTAB <== (.A is lo bite) 



48 

20 de 
48 
8a 
Oa 



68 

95 2a 
68 

95 29 
60 



f9 



setssp pha 
jsr 
pha 
txa 
asl 
tax 



ssdir 



pla 

sta buftab+l,x 

pla 

sta buftab.x 

rts 



Use SS pointer to set DIRBUF 

buffer address hi 

buffer number 

multiplied by 2 

gives pointer to buffer pointer 

table 

hi 

buffer pointer hi 

buffer pointer 

buffer pointer lo 



===> Use SSNUM & SSIND to set SS & BUFTAB <== 



20 68 fa sspos jsr sstest 



30 Oe 
50 13 

a6 15 

b5 79 

20 Id fa 

20 68 fa 

10 07 

20 ae fc ssplO 

2c e5 d2 
60 



bmi 


ssplO 


bvc 


ssp20 


Idx 


lindx 


Ida 


ss,x 


jsr 


ibrd 


jsr 


sstest 


bpl 


ssp20 


jsr 


ssend 


bit 


erl 


rts 





to see if both are resident and 

within range 

N = set means out of range 

V=clear means yes, in residence, so 

store 

get the active buffer number 

and the side sector buffer number 

read in the side sector 

and do another test 

if N-flag clear, it's in range, else 

Set SS & BUFTAB to end of last 

record 

=127 (sets V bit) 

V=0: all OK. V=l: out of range 



tstflg, ssutil, getact, rell, nxtrec 



page . . 1 34 



line addr object 



06366 
06367 

06368 
06369 
06370 
06371 
06372 
06373 
06374 
06375 
06376 
06377 
06378 
06379 
06380 
06381 
06382 
06383 
06384 
06385 
06386 
06387 
06388 
06389 

06390 
06391 
06392 
06393 
06394 
06395 
06396 
06397 
06398 
06399 
06400 
06401 
06402 
06403 
06404 
06405 
06406 



fal4 
fal6 

fal9 
falc 
fald 
fald 
fald 
fald 
fald 
falf 
fa2l 
fa23 
£a25 
fa27 
fa28 
fa2a 
fa2c 
fa2e 
fa2f 
fa31 
fa34 
fa36 
fa38 
fa39 

£a3b 
fa3d 
fa3f 
fa42 
fa44 
fa47 
fa47 
fa47 
fa47 
fa47 
fa49 
fa4b 
fa4e 
fa4e 
fa4e 
fa4e 
fa4e 



a5 84 
20 eb f9 

2c e4 d2 
60 



source code 

ssp20 Ida ssind 
Jsr setssp 

bit erO 
rts 



OK, set pointer with index 
Use SS pointer to set DIRBUF 
& BUFTAB 
=63 (clears N & V bits) 



==> Indirect block read/vnrite <= 



85 al 
a9 80 
dO 04 
85 al 
a9 90 
48 

b5 90 
29 01 
85 12 
68 
05 12 



ibrd 



Ibwt 



ibop 



8d 
bl 



3c 43 
27 



85 13 
c8 
bl 27 



85 14 
a5 al 
20 97 ec 
a6 al 
4c aO fl 



sta Jobnum 


•A = buffer number for R/W 


Ida #read 




bne ibop 




sta jobnum 


current job number 


Ida #write 




pha 


push job code onto stack 


Ida filtyp.x 


file type's drive number 


and #$0l 


mask off non-drive bits 


sta drvnum 


current drive number 


pla 


pull job code, then get the 


ora drvnum 


drive number 


sta cmd 


temporary job command 


Ida (dirbuf),y 


directory buffer pointer 


sta track 


track 


iny 




Ida (dirbuf),y 


& sector of requested side sector 




block 


sta sector 


current sector number 


Ida jobnum 


current job number 


jsr seth 




Idx jobnum 


current job number 


jmp doit2 


do the job 



===> Get side sector pointers <== 



a6 15 
b5 79 
4c e4 fO 



gsspnt Idx lindx 
Ida ss,x 
jmp gpl 



=> Calculate side sectors <= 
a9 78 scall Ida #nssp 



06407 faSO 20 5e fa 



06408 
06409 
06410 
06411 

06412 
06413 



fa53 
fa54 
fa56 
fa58 

fa59 
fa5c 



ca 

10 fS 
a5 07 
4a 

20 5e fa 
a5 08 



jsr addtl2 

sscalc dex 

bpl scall 
Ida t3 
Isr a 

jsr addtl2 
Ida t4 



logical index, channel number 

side sectors table 

Set up pointers for DIRBUF 



the number of side sector pointers 

in a buffer 

add number of side sectors needed * 

120 

(X) " number of last side sector 

branch if .X >= 

number of data block pointers in 

last side sector 

added to (5,6) 

number of side sector blocks needed 



tstflg, ssutU, getact, rell , nxtrec 



page ,.135 



line addr object source code 



064 U 

06415 

06416 

06417 

06418 

06419 

06420 

06421 

06422 

06423 

06424 

06425 

06426 

06427 

06428 

06429 

06430 

06431 

06432 

06433 

06434 

06435 

06436 

06437 

06438 

06439 

06440 

06441 

06442 

06443 

06444 

06445 

06446 

06447 

06448 

06449 

06450 

06451 

06452 

06453 

06454 

06455 

06456 

06457 

06458 

06459 

06460 

06461 

06462 

06463 

06464 

06465 

06466 



faSe 

fa5f 

fa61 

fa63 

fa65 

fa67 

fa68 

fa68 

fa68 

fa68 

fa68 

fa68 

fa68 

fa68 

£a68 

fa68 

fa68 

fa68 

fa68 

fa68 

fa68 

fa6b 

fa6d 

fa6f 

fa71 

fa73 

fa75 

fa78 

fa79 

fa79 

fa7c 

fa7d 

fa7d 

fa7f 

faSl 

fa83 

fa84 

fa85 

fa87 

fa89 

£a8b 

fa8d 

fa90 

fa91 

fa91 

fa94 

fa95 

fa95 

fa95 

fa95 

fa95 

fa97 

fa99 



18 addtl2 clc 
65 05 adc tl 

85 05 sta tl 

90 02 bcc addrts 

e6 06 inc t2 

60 addrts rts 



add (A) to (5,6) 



=> Test SSMUM & SSIND for range and residence <= 



On exit, the flags may have the following meaning: 



range 

OK 

maybe 

bad 

bad 



residence 

yes 

no 

yes 

no 



ER 

ERO 

ERl 

ER2 

ER3 



20 d4 £9 
c5 83 
dO Oe 
a4 84 
bl 27 
fO 04 
2c e4 
60 



d2 



sstest jsr ssset 

cmp ssnum 

bne st20 

Idy ssind 

Ida (dirbuf),y 

beq stlO 

bit erO 
rts 



2c e6 d2 
60 



a5 83 
c9 06 
bO Oa 
Oa 
a8 

a9 04 
85 27 
bl 27 
dO 04 
2c e7 
60 



stlO 



st20 



d2 st30 



2c e5 d2 
60 



st40 



bit er2 
rts 

Ida ssnum 

cmp #nssl 

bcs st30 

asl a 

tay 

Ida #$04 

sta dirbuf 

Ida (dirbuf ),y 

bne st40 

bit er3 

rts 

bit erl 
rts 



number of side sector 
same as requested number? 

(end) pointer in side sector 

data block pointer (track number) 

if 0: no pointer available 

if 63 (clears V & N) — OK, resident 

all OK 

=191 (clears V, sets N) 
out of range 

side sector number 

more than 5 side sectors needed? 

times 2 

=pointer to side sector link table 

position of first link 

directory buffer pointer 

directory buffer pointer 

side sector already allocated? 

255 - sets V & N 

way out of range 

127 sets V, clears N 
not resident — range?? 



===> Get active buffer number <== 



a6 15 getact Idx lindx 
b5 49 Ida bufO.x 

10 02 bpl gal 



logical index, channel number 
channel buffer table I 



tstflg, ssutll, getact, rell, nxtrec 



page ..136 



line 


addr 


object 




source 


code 




06467 


fa9b 


b5 51 






Ida bufl.x 


channel buffer table 2 


06468 


fa9d 


29 bf 




gal 


and #$bf 


clear bit 6 (strip the dirty bit 


06469 


fa9f 


60 






rts 




06470 


faaO 












06471 


faaO 












06472 


faaO 


=> Set 


the Inactive buffer's number <=• 


06473 


faaO 












06474 


faaO 


a6 15 




gaflgs 


Idx lindx 


logical index, channel number 


06475 


faa2 


8e 49 43 




stx Ibused 


last buffer used 


06476 


faa5 


b5 49 






Ida bufO.x 


channel buffer table I 


06477 


faa7 


10 09 






bpl ga3 


if bit 3 not set, this buffer is 
active, else 


06478 


faa9 


8a 






txa 




06479 


faaa 


18 






clc 




06480 


faab 


69 08 






adc ihnxchns 


add 8 to channel number 


06481 


faad 


8d 49 


43 




sta Ibused 


last buffer used 


06482 


fabO 


b5 51 






Ida bufl.x 


channel buffer table 2 


06483 


fab2 


85 05 




ga3 


sta tl 




06484 


fab4 


29 If 






and #$lf 


clear bits 5, 6 and 7 


06485 


fab6 


24 05 






bit tl 


test bits 6 and 7 


06486 


fab8 


60 






rts 




06487 


fab9 












06488 


fab9 












06489 


fab9 


=> Set 


up next 


relative record 


<== 


06490 


fab9 












06491 


fab9 


a9 60 




nxtrec 


Ida #getflg+ovrflo overflow flag 


06492 


fabb 


20 a5 


f8 




jsr clrflg 


clear bit 5 in ($90, x) 


06493 


fabe 


a9 80 






Ida #lrf 


last record flag 


06494 


facO 


20 ae 


f8 




Jsr tstflg 


bit 7 in ($90,x) set? 


06495 


fac3 


dO 41 






bne nxtr40 


yes 


06496 


fac5 


a6 15 






Idx lindx 


current channel number 


06497 


fac7 


f6 59 






inc recl.x 


go to next record# 


06498 


fac9 


dO 02 






bne nxtrl5 




06499 


facb 


f6 61 






inc rech.x 


block count hi, channel 0-7 


06500 


facd 


a6 15 




nxtrl5 


Idx lindx 


logical index, channel number 


06501 


facf 


b5 69 






Ida nr,x 


next record pointers table 


06502 


fad I 


fO 2e 






beq nstr45 




06503 


£ad3 


20 el 


fO 




jsr getpnt 


Get the active buffer pointer 


06504 


fad6 


a6 15 






Idx lindx 


logical index, channel number 


06505 


fadS 


d5 69 






cmp nr,x 


next record pointers table 


06506 


fada 


90 03 






bcc nxtr20 




06507 


fade 


20 25 


fb 




jsr nrbuf 


Set up next record in buffer 


06508 


fadf 


a6 15 




nxtr20 


1 Idx lindx 


logical index, channel number 


06509 


fael 


b5 69 






Ida nr,x 


next record pointers table 


06510 


fae3 


20 cl 


fO 




jsr setpnt 


Set up pointer into active data 
buffer 


06511 


fae6 


al 29 






Ida (buftab.x) 


buffer pointer lo 


06512 


faeS 


85 18 






sta data 


temporary data byte 


06513 


faea 


a5 60 






Ida getflg+ovrflo 


06514 


faec 


20 a5 


f8 




jsr clrflg 


reset bit 5 in ($90, x) 


06515 


faef 


20 ec 


fd 




jsr addnr 


Add record size and next record 
pointer 


06516 


faf2 


48 




nzout 


pha 


store it 



tstflg, ssutil, getact, rell , nxtrec 



page ..137 



line addr object 



source code 



06517 
06518 
06519 

06520 
06521 
06522 
06523 
06524 
06525 
06526 
06527 
06528 
06529 
06530 
06531 
06532 
06533 
06534 
06535 
06536 
06537 
06538 
06539 
06540 
06541 
06542 

06542 
06543 



faf3 90 28 
fafS a9 00 
faf7 20 ef fO 



fafa 
fafc 
fafd 
faff 
fbOl 
fb03 
fb06 
fb09 
fbOb 
fbOe 
fblO 
fbl2 
fbl3 
fbl3 
fbl6 
fbl8 
fbla 
fblc 
fbld 
fbld 
fble 
fb20 
fb22 

fb25 
fb25 



dO 21 
68 

c9 02 
fO 12 
a9 80 
20 9f f8 
20 bO ed 
b5 29 
99 bd 00 
a9 Od 
85 18 
60 

20 Ve fb 
a6 15 
a9 00 
95 69 
60 

68 

a6 15 
95 69 
4c 53 fc 



bcc nxtr30 
Ida #$00 
Jsr drdbyt 



bne 
pla 

Cfflp 

beq 
nstr45 Ida 
jsr 
nxtr40 jsr 
Ida 
sta 
Ida 
sta 
rts 



nxtrSO 

#$02 

nxtr50 

#lrf 

setflg 

getpre 

buftab.x 

Istchr , y 

#cr 

data 



nxtr50 jsr nxtr35 
Idx lindx 
Ida #$00 
sta nr,x 
rts 

nxtr30 pla 

nxtr35 Idx lindx 
sta nr,x 
jmp setlst 



.lib nrbuf 



gone over end of block? 

yes 

Direct read of a byte (.A = 

position) 

track link <> 0? 

write pointer 

=2? 

set bit 7 

Set flag 

Set buffer pointers 

get the pointer, use as 

end pointer 

throw in a carriage return 

temporary data byte 



logical index, channel number 
next record pointers table 



logical Index, channel number 
next record pointers table 
Set pointer to last character in 
record 



nrbuf, rel2-4, ssend, record 



page ..138 



line 


addr 


object 


source 


code 


06545 


fb25 


=> Set up next : 


record in buffer 


06546 


fb25 








06547 


fb25 


20 54 ee 


nrbuf 


jsr setdrn 


06548 


fb28 


20 97 £9 




jsr rdlnk 


06549 


fb2b 


20 aO fa 




jsr gaflgs 


06550 


fb2e 


50 16 




bvc nrbu50 


06551 


fb30 


20 60 £9 




jsr wrtout 


06552 


fb33 


20 d6 eb 




jsr dblbuf 


06553 


fb36 


a9 02 




Ida #$02 


06554 


fb38 


20 c\ £0 




jsr setpnt 


06555 


fb3b 


20 b3 £8 




jsr tstwrt 


06556 


fb3e 


dO 24 




bne nrbu20 


06557 


fb40 


20 59 £9 




jsr rdab 


06558 


fb43 


4c 87 ec 




jmp watjob 


06559 


fb46 








06560 


£b46 


20 d6 eb 


nrbu50 


jsr dblbuf 


06561 


fb49 


20 b3 £8 




jsr tstwrt 


06562 


£b4c 


dO 06 




bne nrbu70 


06563 


fb4e 


20 59 £9 




jsr rdab 


06564 


fb51 


20 87 ec 




jsr watjob 


06565 


£b54 


20 97 £9 


nrbu70 


1 jsr rdlnk 


06566 


fb57 


a5 13 




Ida track 


06567 


fb59 


£0 09 




beq nrbu20 


06568 


fb5b 


20 d6 eb 




jsr dblbuf 


06569 


£b5e 


20 59 £9 




jsr rdab 


06570 


fb61 


20 d6 eb 




jsr dblbuf 


06571 


fb64 


60 


nrbu2C 


1 rts 


06572 


£b65 








06573 


£b65 








06574 


£b65 


===> Put 


relative record into bul 


06575 


£b65 








06576 


fb65 


20 eb £b 


relput jsr sdirty 


06577 


fb68 


20 95 fa 




jsr getact 


06578 


fb6b 


Oa 




asl a 


06579 


fb6c 


aa 




tax 


06580 


fb6d 


a5 18 




Ida data 


06581 


£b6f 


81 29 




sta (buftab.x) 


06582 


fb7X 


b4 29 




Idy buftab.x 


06583 


fb73 


c8 




iny 


06584 


fb74 


dO 09 




bne relp06 


06585 


fb76 


a4 15 




Idy lindx 


06586 


fb78 


b9 69 00 




Ida nr,y 


06587 


fb7b 


£0 Oa 




beq relp07 


06588 


£b7d 


aO 02 




Idy #$02 


06589 


fb7f 


98 


relp06 tya 


06590 


fb80 


a4 15 




Idy llndx 


06591 


£b82 


d9 69 00 




cmp nr.y 



Set drive number 

Set TRACK & SECTOR from link in 

buffer 

Get active buffer and set LBUSED 

V clear means buffer not dirty 

(changed) so no need to write 

dirty — write out 

Toggle buffer 

point to first data byte in the new 

sector 

Set up pointer into active data 

buffer 

Test if this is a write job 

not a write job 

read in needed buffer, then 

wait around until done 

Toggle active buffer 

Test if this is a write job 

not a write job 

read in needed buffer 

Wait until job is completed 

Set TRACK & SECTOR from link in 

buffer 

current track number 

if track link =0 then it's last 

block 

start read job on the 

inactive buffer 

Toggle 



Set buffer dirty flag 
Get active buffer number 
multiply buffer number by two 
pointer in BP table 
temporary data byte 
buffer pointer lo 
Increment the pointer 
if new pointer value is NOT I, 

log. index/channel number 
next record pointers table 

point to first data byte 

log. index/channel number 
next record pointers table 



nrbuf, rel2-4, ssend, record 



page ,.139 



line addr object source code 



06592 fb85 dO 05 



06593 
06594 
06595 
06596 
06597 
06598 
06599 
06600 
06601 
06602 
06603 
06604 
06605 



06606 
06607 
06608 
06609 
06610 
06611 
06612 
06613 
06614 
06615 
06616 
06617 
06618 
06619 
06620 
06621 
06622 
06623 
06624 
06625 



fb87 
fb89 
fb8c 
fbSc 
fb8e 
fb90 
fb93 
fb94 
fb94 
fb94 
fb94 
fb94 
fb96 



fb96 
fb99 
fb9b 
fb9d 
fbaO 
fba2 
fba4 
fba5 
fba5 
fba7 
fbaa 
fbac 
fbae 
fbbl 
fbb4 
fbb7 
fbba 
fbbc 
fbbf 
fbbf 



a9 20 
4c bO ed 

f6 29 
dO 03 
20 25 fb 
60 



bne relplO 

relp07 Ida #ovrflo 
jmp getpre 

relplO inc buftab.x 
bne relp20 
jar nrbuf 

relp20 rts 



==> Write out relative records <= 
a9 aO wrtrel Ida #lrf+ovrf lo 



20 ae f8 
dO 24 
a5 18 
20 65 fb 
a5 aO 
fO Od 
60 

a9 20 
20 ae fS 
fO 05 
a9 51 
8d 73 43 
20 d9 fb 
20 39 fc 
ad 73 43 
fO Ob 
4c c9 db 

29 80 



06626 fbcl dO 05 



06627 
06628 
06629 
06630 
06631 
06632 
06633 
06634 
06635 
06636 
06637 
06638 
06639 



fbc3 
fbc5 
fbc7 
fbc8 
fbc8 
fbca 
fbcb 
fbce 
fbcf 
fbdl 
fbd3 
fbd6 
fbd9 



a5 aO 
fO de 
60 

a5 18 

48 

20 04 f e 

68 

85 18 

a9 80 

20 a5 f8 

4c 9b f b 



Jsr tstflg 

bne wr50 
wrlO Ida data 

jsr relput 
wr20 Ida eolflg 

beq wr40 

rts 

wr30 Ida #ovrflo 
jar tstflg 
beq wr40 
Ida #recovf 
sta erword 

wr40 jsr clrec 
Jsr rd40 
Ida erword 
beq wr51 
jmp cmderr 

wr50 and #lrf 

bne vn'60 

Ida eoiflg 
beq wr30 
wr51 rts 



wr60 



Ida data 

pha 

jsr addrel 

pla 

sta data 

Ida #lrf 

jsr clrflg 

jmp wrlO 



if NR <> pointer then NR isn't a 
pointer so set a new one 
set bit 5 (overflow flag) in ($90, x) 
Set buffer pointers 

write back new pointer 

if then next buffer not needed 

Set up next record in buffer 



check all flags 

to check for last record and 

overflow. If clear, some flag is 

set 

Test flag 

ready to put data 

Put relative record into buffer 

current EOI status 

EOI was sent 



bit 5 (overflow) set? 

Test flag 

if Z set, no record over low 

overflow in record error — flag: 

set error for end of print 

Clear rest of relative record 

error word for recovery 

if no errors 

Command level error handling 

error flag AND last record flag not 

0, branch 

because last record flag is set, so 

add to file 

BOX sent? 



temporary data byte 

Add blocks to a relative file 
add to the relatve file 
temporary data byte 
last record flag 
Clear flag 



nrbuf, rel2-4, ssend, record 



page . . 1 40 



line addr object 



source code 



06640 
06641 
06642 
06643 
06644 
06645 
06646 
06647 
06648 
06649 
06650 
06651 
06652 
06653 
06654 
06655 
06656 
06657 
06658 
06659 
06660 
06661 
06662 
06663 
06664 
06665 
06666 
06667 
06668 
06669 
06670 
06671 
06672 
06673 
06674 
06675 
06676 
06677 
06678 
06679 
06680 
06681 
06682 

06683 
06684 
06685 
06686 
06687 
06688 
06689 



£bd9 
fbd9 
fbd9 
fbd9 
fbdb 
fbde 
fbeO 
£be2 
fbe4 
fbe7 
fbea 
fbea 
fbeb 
fbeb 
fbeb 
fbeb 
fbeb 
fbee 
fbfO 
fbf3 
fbf5 
fbf6 
fbf6 
fbf6 
fbf6 
fbf6 
fbf9 
fbfb 
fbfe 
fcOO 
fcOl 
fcOl 
fcOl 
fcOl 
fcOl 
fc03 
fc06 
fc08 
fcOa 
fcOd 
fclO 
fcl2 
fcl5 

fcl7 
fcl9 
fclb 
fcle 
fc21 
fc23 
fc26 



=> Clear rest of relative record <= 



a9 20 
20 ae f8 
dO Oa 
a9 00 
85 18 
20 65 fb 
4c d9 fb 

60 



clrec 



Ida #ovrflo 
jsr tstflg 
bne clrlO 
Ida #$00 
sta data 
jar relput 
jap clrec 



drlO rts 



===> Set buffer dirty flag <== 

20 aO fa sdirty jar gaflgs 

09 40 ora #get£lg 

ae 49 43 Idx Ibused 

95 49 sta bufO.x 

60 rts 



==> Clear buffer dirty flag <= 

20 aO fa cdirty jsr gaflgs 
29 bf and #$bf 

ae 49 43 Idx Ibused 
95 49 sta bufO.x 

60 rts 



=> Read relative records <=> 



a9 80 
20 ae f8 
dO 3c 
a9 40 
20 9f £8 
20 bO ed 
b5 29 
d9 bd 00 
fO 22 

f6 29 

dO 06 

20 25 fb 

20 bO ed 

al 29 

99 b5 00 

a9 89 



rdrel 



rdlO 



rdl5 
rd20 
rd25 



06690 fc28 99 98 00 



Ida #lrf 
jsr tstflg 
bne rd05 
Ida #getflg 
jsr setflg 
jsr getpre 
Ida buftab,x 
cmp Istchr.y 
beq rd40 

Inc buftab,x 
bne rd20 
jsr nrbuf 
jsr getpre 
Ida (buftab.x) 
sta chndat,y 
Ida #rndrdy 

sta chnrdy,y 



there is overflow 



overflow flag 

Test flag 

if Z not set, 

null byte 

temporary data byte 

Put relative record into buffer 

Clear rest of relative record 



Get active buffer and set LBUSED 
set dirty flag bit 6 
last buffer used 



Get active buffer and set LBUSED 
clear dirty flag bit 6 
last buffer used 



last record flag 

Test flag 

no record error 



Set buffer pointers 

buffer pointer lo 

channel last character pointer 

if = end pointer. Since we want the 

next record, set one up 

buffer pointer lo 

BP =• 0? no need for next buffer 

Set up next record in buffer 

Set buffer pointers 

buffer pointer lo 

channel data byte 

R/W random access ready, reset EOI. 

Store as channel status 

write, read, eoi flags, channel 

status 



nrbuf, rel2-4, ssend, record 



page ..141 



line addr object source code 



06691 
06692 
06693 
06694 
06695 
06696 
06697 

06698 
06699 
06700 
06701 
06702 
06703 
06704 
06705 
06706 
06707 
06708 
06709 

06710 
06711 
06712 
06713 
06714 
06715 
06716 
06717 
06718 
06719 
06720 

06721 
06722 
06723 
06724 
06725 
06726 
06727 
06728 
06729 

06730 
06731 



£c2b 
fc2d 
fc30 
fc32 
fc33 
fc33 
fc35 

fc38 
fc39 
fc39 
fc3c 
fc3f 
fc41 
fc44 
fc44 
fc46 
fc48 
fc4a 
fc4c 

fc4e 
fc50 
fc53 
fc53 
fc53 
fc53 
fc53 
fc55 
fc57 
fc59 
fc5b 

fc5d 
fc5f 
fc6l 
fc63 
fc65 
fc67 
fc6a 
fc6c 
fc6e 

fc70 
fc72 



b5 29 
d9 bd 00 
fO 01 
60 

a9 81 
99 98 00 

60 

20 b9 fa 
20 bO ed 
a5 18 
4c 23 fc 

a6 15 
a9 Od 
95 b5 
a9 81 
95 98 

a9 50 
20 c9 db 



rd30 



rd40 



rd05 



Ida buftab.x 

cmp Istchr.y 

beq rd30 
rts 

Ida #rndeoi 
sta chnrdy.y 

rts 

jsr nxtrec 
Jsr getpre 
Ida data 
jmp rd25 

Idx lindx 
Ida #cr 
sta chndat,x 
Ida #rndeoi 
sta chnrdy,x 

Ida #norec 
Jsr cmderr 



buffer pointer lo 

channel last character pointer 

if BP = end pointer 



EOI flag 

write, read, eoi flags, channel 

status 



Set up next relative record 
Set buffer pointers 
temporary data byte 



no record character set up 

CR 

channel data byte 

set R/W, EOI 

vfrite, read, eoi flags, channel 

status 

record not present error 

Conmand level error handling 



=> Set pointer to last character in record <= 



a6 15 
b5 69 
85 la 
c6 la 
c9 02 

dO 04 
a9 ff 
85 la 
b5 71 
85 lb 
20 el 
a6 15 
c5 la 
90 18 



fO 16 
20 d6 eb 



fO 



06732 fc75 20 95 fc 



06733 
06734 
06735 
06736 



fc78 
fc7a 
fc7c 
fc7e 



90 07 
a6 15 
95 bd 
4c d6 eb 



setlst Idx lindx 
Ida nr,x 
sta rl 
dec rl 
cmp #$02 

bne setlOl 
Ida #$ff 
sta rl 
setlOl Ida rs,x 
sta r2 
jsr getpnt 
Idx lindx 
cmp rl 
bcc setllO 

beq set 110 
jsr dblbuf 

jsr fndlst 

bcc setl05 
Idx lindx 
sta lstchr,x 
Jmp dblbuf 



log. index/channel number 
next record pointers table 



pointer to first data byte in the 
sector 

point to last byte in 

record 

copy record size 

Get the active buffer pointer 
log. index/channel number 

BP >= end pointer in R17 Then find 
last non-0 character 

Double buffer: switch 

active/inactive buffers 

Find last non-zero character in 

record 

log. index/channel number 
channel last character pointer 
Double buffer: switch 
active/inactive buffers 



nrbuf, rel2-4, ssend, record 



page ..142 



line addr object 



source code 



06737 
06738 

06739 
06740 
06741 

06742 
06743 
06744 
06745 
06746 
06747 
06748 
06749 
06750 
06751 
06752 
06753 
06754 
06755 
06756 
06757 

06758 
06759 
06760 
06761 
06762 
06763 
06764 
06765 
06766 
06767 
06768 
06769 
06770 
06771 
06772 
06773 

06774 
06775 
06776 
06777 

06778 
06779 
06780 
06781 
06782 
06783 
06784 



fc81 
£c8l 

£c84 
fc86 
fc88 

fc8b 
fc8d 
fc90 
fc92 
fc94 
fc95 
fc95 
fc95 
fc95 
fc95 
fc98 
fc9a 
fc9c 
fc9e 
fc9f 
fcal 

fca3 
fca5 
£ca7 
fca9 
fcaa 
fcab 
fcab 
fcac 
fcad 
fcae 
fcae 
fcae 
fcae 
fcae 
fcbl 
fcb3 

fcbS 
fcb7 
fcb9 
fcbb 

fcbb 
fcbc 
fcbd 
fcbf 
feci 
£cc3 
fcc4 



20 d6 eb setl05 Jsr dblbuf 

a9 ff Ida #$ff 

85 la sta rl 

20 95 fc setllO jsr fndlst 

bO 03 bcs setl40 

20 el fO Jsr getpnt 

a6 15 setl40 Idx lindx 
95 bd sta Istchr.x 

60 rts 



Double buffer: switch 
active/iaactlve buffers 



Find last non-zero character in 
record 

Get the active buffer pointer 
log. index/channel number 
channel last character pointer 



=> Find last non-zero character in record <=== 



20 2b 
a4 la 
bl 27 
dO Od 
88 

cO 02 
90 04 

c6 lb 
dO f3 
c6 lb 
18 
60 

98 
38 
60 



f9 fndlst jsr setOO 
Idy rl 
fndllO Ida (dirbuf),y 
bne fndl20 
dey 

cpy #$02 
bcc fndl30 

dec r2 
bne fndllO 
fndl30 dec r2 
clc 
rts 

fndl20 tya 
sec 
rts 



Set up pointer to active buffer 

directory buffer pointer 

byte in buffer = 0? 

pointer = 

less than or equal to 2? 

then there isn't one, since start of 

record not in here 

if not counted down to yet 

to indicate record not found 



last non-zero character found 
so set carry flag and 



=> Set side sector & BUFTAB to end of last record <== 



20 d4 f9 
85 83 
a9 04 

85 27 
aO Oa 
dO 04 



88 
88 

30 26 
bl 27 
fO f8 
98 
4a 



ssend 



selO 



se20 



jsr 


ssset 


sta 


ssnuffl 


Ida #$04 


sta 


dirbuf 


Idy #ssioff-6 


bne 


se20 


dey 




dey 




bmi 


break 


Ida 


(dirbuf ),y 


beq 


selO 


tya 




Isr 


a 



Set side sector pointers to 

side sector number 

points to first side sector's track 

number 

directory buffer pointer 

offset to last side sector track 

always 

test if last or previous side sector 

tracks have been written (= 0) 



if less than 

look for last side sector # 

last ss# =0? Not yet found 

offset for last side sector track 

number of last side sector equal to 

current 



nrbuf, rel2-4, ssend, record 



page ..143 



line 


addr 


object 


source code 




06785 


fcc5 


c5 83 






cmp ssnum 


side sector number 


06786 


fcc7 


fO 09 






beq se30 


yes — last side sector here, so 
store # 


06787 


fcc9 


85 83 






sta ssnum 


side sector number 


06788 


fccb 


a6 15 






Idx lindx 


log. index/channel number 


06789 


feed 


b5 79 






Ida ss,x 


side sectors table 


06790 


fecf 


20 Id 


fa 




jsr ibrd 


read last side sector 


06791 


fcd2 


aO 00 




se30 


Idy #$00 


set side sector index 


06792 


fed4 


84 27 






sty dlrbuf 


directory buffer pointer 


06793 


fcd6 


bl 27 






Ida (dirbuf),y 


debug 


06794 


fedS 


dO Ob 






bne break 


last side sector track link must b 



06795 


fcda 


c8 






iny 


06796 


fedb 


bl 27 






Ida (dirbuf),y 


directory buffer pointer 


06797 


fcdd 


a8 






tay 


back up to track 


06798 


fcde 


88 






dey 




06799 


fcdf 


84 84 






sty ssind 


(end) pointer in side sector 


06800 


feel 


98 






tya 


end pointer -1 


06801 


fee2 


4c eb 


f9 




Jmp setssp 


Use side sector pointer to set 
DIRBUF & BUFTAB 


06802 


fce5 












06803 


fce5 


==> Indicate system TRACK OR SECTOR error <= 


06804 


fee5 












06805 


fce5 


a9 67 




break 


Ida #$67 


illegal track or sector error 


06806 


fce7 


20 5c 


d9 




jsr cmder2 




06807 


fcea 












06808 


fcea 












06809 


fcea 


===> RECORD coDima 


,nd — position pointer to given record <=== 


06810 


fcea 












0681 1 


fcea 


20 b6 


dc 


record 


jsr cmdset 


Initialize cmd tables & pointers 


06812 


feed 


ad 01 


43 




Ida cmdbuf+t 




06813 


fcfO 


85 16 






sta sa 


current secondary address 


06814 


fef2 


20 6e 


ed 




jsr fndreh 


Find the assigned read channel 


06815 


fcfS 


90 05 






bcc r20 


if clear, channel found 


06816 


fcf7 


a9 70 






Ida #nochnl 


no channel error 


06817 


fcf9 


20 c9 


db 




jsr cmderr 


Command level error handling 


06818 


fefe 












06819 


fefc 


a9 eO 




r20 


Ida #lrf+getflg+ovrflo for bit 6 & 7 


06820 


fcfe 


20 a5 


f8 




jsr clrflg 


Clear flag 


06821 


fdOl 


20 a6 


ed 




jsr typfil 


Get current file type 


06822 


fd04 


fO 05 






beq r30 


relative? 


06823 


fd06 


a9 64 






Ida #mi3typ 


file type mismatch error 


06824 


fd08 


20 c9 


db 




jsr cmderr 


Command level error handling 


06825 


fdOb 












06826 


fdOb 


b5 90 




r30 


Ida filtyp,x 


file type flags, channel 0-7 


06827 


fdOd 


29 01 






and #$01 


mask off non-drive bits, result is 


06828 


fdOf 


85 12 






sta drvnum 


current drive number 


06829 


fdll 


ad 02 


43 




Ida cmdbuf+2 


3rd command byte 


06830 


fdl4 


95 59 






sta recl.x 


= record number lo 


06831 


fdl6 


ad 03 


43 




Ida cmdbuf-t-3 


4th byte 


06832 


fdl9 


95 61 






sta rech,x 


= record number hi 


06833 


fdlb 


a6 15 






Idx lindx 


clear CNRDY to RNRDY 


06834 


fdld 


a9 89 






Ida #rndrdy 


random access ready 



nrbuf, rel2-4, ssend, record 



page ,.144 



line addr object source code 

06835 fdlf 95 98 sta chnrdy.x 

06836 fd21 ad 04 43 Ida cmdbuf+4 



06837 
06838 
06839 
06840 
06841 
06842 
06843 
06844 
06845 
06846 
06847 
06848 
06849 
06850 
06851 
06852 
06853 
06854 
06855 
06856 
06857 
06858 
06859 
06860 
06861 
06862 
06863 
06864 
06865 



fd24 
fd26 
fd27 
fd29 
fd2b 
fd2d 
fd2f 
fd31 
fd34 
£d36 
fd38 
fd3b 
fd3e 
£d40 
fd42 
fd45 
fd48 
fd48 
fd4b 
£d4d 
£d50 
fd52 
fd55 
fd55 
fd58 
fd58 
fd58 
fd58 
fd58 



£0 10 
38 

e9 01 
£0 Ob 
d5 71 
90 07 
a9 51 
8d 73 43 
a9 00 
85 82 
20 b3 ea 
20 fa £9 
50 08 
a9 80 
20 9£ £8 
4c 44 fc 

20 58 £d 
a9 80 
20 ae £8 
£0 03 
4c 44 £c 



r40 



r50 



beq r40 
sec 

sbc #$01 
beq r40 
cmp rs,x 
bcc r40 
Ida #recov£ 
sta erword 
Ida #$00 
sta recptr 
Jsr fndrel 
Jsr sspos 
bvc r50 
Ida #lr£ 
jsr set£lg 
jBip rd05 

jsr posltn 
Ida #lrf 
jsr tstflg 
beq r60 
jmp rd05 



4c 9f db r60 jmp endcmd 

=> Position to record <== 
20 7a £d posltn jsr posbu£ 



06866 


£d5b 


a5 85 






Ida 


relptr 


06867 


fdSd 


20 cl 


£0 




jar 


setpnt 


06868 


£d60 


a6 15 






Idx 


llndx 


06869 


£d62 


b5 71 






Ida 


rs.x 


06870 


£d64 


38 






sec 




06871 


£d65 


e5 82 






sbc 


recptr 


06872 


£d67 


bO 03 






bcs 


P2 


06873 


fd69 


4c e5 


£c 




jmp 


break 


06874 


£d6c 












06875 


£d6c 


18 




P2 


clc 




06876 


£d6d 


65 85 






adc 


relptr 


06877 


fd6£ 


90 03 






bcc 


p30 


06878 


£d71 


69 01 






adc 


#$01 


06879 


£d73 


38 






sec 




06880 


fd74 


20 £2 


fa 


p30 


jsr 


nxout 


06881 


fd77 


4c le 


fc 




jmp 


rdl5 


06882 


fd7a 













Vfrite, read, eoi flags, channel 

status 

offset 5th byte; byte pointer into 

record 

= 0? 

byte number 

-1 (because of CR separator) 

if 

record sizes table 

if < record size 

OVERFLOW IN RECORD error 

error word for recovery 

position in record 

set offset 

calculate side sector stuff 

set side sector pointers 

data block present? 

last record flag, bit 7 

Set last record flag 



Position to record 
last record flag 
Test flag 
not set 



That's all 



Position proper data blocks into 

buffers 

relative file pointer to track 

Set up pointer Into active data 

buffer 

log. index/ channel number 

record sizes table 

calculate the offset 

- position in record 

If offset > — else we're in 

trouble: 

should not be needed 



add REL data block pointer 

< 256? y> 

+ 2 (carry =11) 



nrbuf, rel2-4, ssend, record 



page ..145 



line addr object 



source code 



06883 


fd7a 








06884 


fd7a 


==> Position proper data bloc 


06885 


fd7a 








06886 


fd7a 


a5 27 


posbuj 


: Ida dirbuf 


06887 


fd7c 


85 Ic 




sta r3 


06888 


fd7e 


a5 28 




Ida dirbuf+1 


06889 


fd80 


85 Id 




sta r4 


06890 


fd82 


20 b8 £d 




jsr bhere 


06891 


fd85 


fO 22 




beq p20 


06892 


fd87 


20 fl f8 




jsr scrub 


06893 


fdSa 


20 Oc f9 




jsr getlnk 


06894 


fd8d 


a5 13 




Ida track 


06895 


fd8f 


fO 19 




beq p80 


06896 


fd9l 


20 d6 eb 




jsr dblbuf 


06897 


fd94 


20 b8 fd 




jsr bhere 


06898 


fd97 


dO 11 




bne p80 


06899 


fd99 


20 Oc f9 




jsr getlnk 


06900 


fd9c 


a5 13 




Ida track 


06901 


fd9e 


fO 09 




beq p20 


06902 


fdaO 


20 d6 eb 




jsr dblbuf 


06903 


fda3 


20 59 f9 




jar rdab 


06904 


fda6 


20 d6 eb 




jsr dblbuf 


06905 


fda9 


60 


p20 


rts 


06906 


fdaa 








06907 


fdaa 


aO 00 


p80 


Idy #$00 


06908 


fdac 


bl Ic 




Ida (r3).y 


06909 


fdae 


85 13 




sta track 


06910 


fdbO 


c8 




iny 


06911 


fdbl 


bl Ic 




Ida (r3),y 


06912 


fdb3 


85 14 




sta sector 


06913 


fdb5 


4c 22 ed 




jfflp strdbl 


06914 


fdbS 








06915 


fdb8 








06916 


fdbS 


===> Check 


If desired block is 


06917 


fdb8 








06918 


fdb8 


20 3e f9 


bhere 


Jsr gethdr 


06919 


fdbb 


aO 00 




Idy #$00 


06920 


fdbd 


bl Ic 




Ida (r3).y 


06921 


fdbf 


c5 13 




cmp track 


06922 


fdcl 


fO 01 




beq bhlO 


06923 


£dc3 


60 




rts 


06924 


fdc4 


c8 


bhlO 


iny 


06925 


fdc5 


bl Ic 




Ida (r3),y 


06926 


fdc7 


c5 14 




cmp sector 


06927 


fdc9 


60 




rts 


06927 


fdca 








06928 


fdca 






.lib nulbuf 



directory buffer pointer 

current buffer pointer hi 

Check if desired block is in buffer 

link bytes » T/S from header buffer? 

Clean buffer 

Set TRACK & SECTOR from link in 

buffer 

current track number 

track link = (final block)? 

try inactive buffer 

is this the one? 

no 

Set TRACK & SECTOR from link in 

buffer 

current track number 

final block? 

Double buffer: switch 

active/inactive buffers 

read in next buffer 

Toggle buffer 



ger proper block 

track link 

current track number 

sector link 

current sector number 

get next block as well, then RTS 



get the header 

track link 
current track number 
test sector as well 
Z=0 



sector link 

Z=l if they are equal 



nulbuf , newss .vectors , checksum 



page 



.146 



line addr object 



source code 



06930 
06931 
06932 
06933 
06934 
06935 
06936 
06937 
06938 
06939 
06940 
06941 
06942 
06943 

06944 
06945 
06946 
06947 
06948 
06949 
06950 
06951 
06952 
06953 
06954 
06955 
06956 
06957 
06958 

06959 
06960 
06961 
06962 
06963 
06964 
06965 
06966 
06967 
06968 
06969 
06970 
06971 
06972 
06973 
06974 



fdca 
fdca 
fdca 
fdcd 
fdcf 
fddl 
fdd3 
fdd4 
fdd6 
fdd9 
fddb 
fddc 
fdde 
fdeO 

fde3 
fde5 
£de7 
fde9 
fdeb 
fdec 
fdec 
fdec 
fdec 
fdec 
fdec 
fdee 
fdfO 
fdfl 
fdf3 

fdf4 
fdf6 
fdf8 
fdfa 
fdfc 
fdff 
feOO 
feOO 
fe02 
fe03 
fe04 
£e04 
fe04 
fe04 
fe04 
fe07 



=> Set null records in active buffer <= 



20 2b f9 
aO 02 
a9 00 
91 27 
c8 

dO fb 
20 ec 
95 69 
a8 

a9 ff 
91 27 
20 ec 



fd 



fd 



nulbuf jsr 
Idy 
Ida 
sta 
iny 
bne 

sta 
tay 
Ida 
sta 
jsr 



nb20 



nb25 



setOO 
#$02 
#$00 
(dirbuf),y 

nb20 

addnr 

nr,x 

#$ff 

(dirbuf),y 

addnr 



90 f4 
dO 04 
a9 00 
95 69 
60 



nb30 



bcc nb25 
bne nb30 
Ida #$00 
sta nr,x 
rts 



Set indirect pointer 

zeroize buffer from 3rd byte onwards 
directory buffer pointer 

(AC) points to next record 
next record pointers table 

for 1st byte in next record 

init record with CR 

Add record size and next record 

pointer 

not done 

last byte is end of record? n> 

flag last record 

next record pointers table 



=> Add record size and next record pointer <=== 
on exit: Ol if buffer boundary crossed 



a6 15 
b5 69 
38 

fO Od 
18 

75 71 
90 Ob 
dO 06 
a9 02 
2c e3 d2 
60 

69 01 

38 

60 



addnr Idx lindx 
Ida nr,x 
sec 

beq an05 
clc 

adc rs,x 
bcc anlO 
bne an05 
Ida #$02 
bit erOO 
rts 

an05 adc #$01 

sec 
anlO rts 



log. index/channel number 

next record pointers table 

after loading next record pointer 

then add record size; test if < or 

256 

record sizes table 



bypass link, set flags 

Error flag variables for use by BIT 



adjust for link & set carry flag 



=> Add blocks to a relative file <= 



20 54 ee addrel Jsr setdrn 
20 ae fc Jsr ssend 



06975 feOa 20 7a fd 



06976 feOd 

06977 feOf 

06978 fell 



a5 84 
85 la 
a5 83 



Jsr posbuf 

Ida sslnd 
sta rl 
Ida ssnuffl 



Set drive number 

Set side sector & BUFTAB to end of 

last record 

Position proper data blocks into 

buffers 

save side sector index 

save side sector number 



nulbuf , newss , vectors .checksum 



page ..147 



line 


addr 


object 


source code 


06979 


fel3 


85 19 


sta 


rO 


06980 


fel5 


a9 00 


Ida #$00 


06981 


fe17 


85 lb 


sta 


r2 


06982 


fe19 


a9 00 


Ida 


#$00 


06983 


felb 


85 82 


sta 


recptr 


06984 


feld 


20 b3 ea 


jsr 


fndrel 


06985 


fe20 


20 34 db 


Jsr 


numfre 


06986 


fe23 


a4 15 


Idy 


lindx 


06987 


fe25 


b6 71 


Idx 


rs,y 


06988 


fe27 


ca 


dex 




06989 


fe28 


8a 


txa 




06990 


fe29 


18 


clc 




06991 


fe2a 


65 85 


adc 


relptr 


06992 


fe2c 


90 Oc 


bcc 


arlO 


06993 


fe2e 


e6 84 


inc 


ssind 


06994 


fe30 


e6 84 


inc 


ssind 


06995 


fe32 


dO 06 


bne 


arlO 


06996 


fe34 


e6 83 


inc 


ssnum 


06997 


fe36 


a9 10 


Ida #ssioff 


06998 


fe38 


85 84 


sta 


ssind 


06999 


fe3a 








07000 


fe3a 


a5 la 


arlO Ida 


rl 


07001 


fe3c 


18 


clc 




07002 


fe3d 


69 02 


adc 


#$02 


07003 


fe3f 


20 eb f9 


jsr 


setssp 


07004 


fe42 


a5 83 


Ida 


ssnum 


07005 


fe44 


c9 06 


cop 


#n3sl 


07006 


fe46 


90 05 


bcc 


ar25 


07007 


fe48 


a9 52 


ar20 Ida 


#bigfil 


07008 


fe4a 


20 c9 db 


Jsr 


cmderr 


07009 


fe4d 


a5 84 


ar25 Ida 


ssind 


07010 


fe4f 


38 


sec 




070H 


fe50 


e5 la 


sbc 


rl 


07012 


fe52 


bO 03 


bcs ar30 


07013 


fe54 


e9 Of 


sbc #$0f 


07014 


fe56 


18 


clc 




07015 


fe57 


85 07 


ar30 sta 


t3 


07016 


fe59 


a5 83 


Ida 


ssnum 


07017 


fe5b 


e5 19 


sbc 


rO 


07018 


fe5d 


85 08 


sta 


t4 


07019 


fe5f 


a2 00 


Idx #$00 


07020 


£e61 


86 05 


stx 


tl 


07021 


fe63 


86 06 


stx 


t2 


07022 


fe65 


aa 


tax 




07023 


fe66 


20 53 fa 


jsr 


sscalc 


07024 


fe69 


a5 06 


Ida 


t2 


07025 


fe6b 


dO 07 


bne ar35 


07026 


fe6d 


a6 05 


Idx 


tl 


07027 


fe6f 


ca 


dex 





temporary result 

clear flag for one block 

clear RECPTR for calculations 

pointer to start of record 

calculate side sector pointers 

Get number of blocks free in DRVNUM 

log. index/channel number 

record sizes table 

reduce size 

add record pointer to record size: 
relative file pointer to track 
no carry: no span to next block 
(end) pointer in side sector 
(end) pointer in side sector 

side sector number 

side sector offset (will start new 

block) 

(end) pointer in side sector 



Use side sector pointer to set 

DIRBUF & BUFTAB 

side sector number 

number of side sector links 

if valid (less than or equal to 6) 

file too large error 

Command level error handling 

calculate number of blocks needed 

and check 

against available 

if result is positive. 

side sector index offset -1 

and store number of s-s indices into 

# of side sector indices 

side sector number 

to find number of s-s needed, store 

into 

set up results accumulator area 



.X= side sector number 

calculate number of blocks needed 

hi byte of number we need. If not 0, 

if lo byte 
minus 1 



nulbuf , newss , vectors , checksum 



page ..148 



line 


addr 


object 


source code 


07028 


fe70 


dO 02 




bne 


ar35 


07029 


fe72 


e6 lb 




Inc 


r2 


07030 


fe74 


cd 78 43 


ar35 cmp 


nbtemp+l 


07031 


fe77 


90 09 




bcc 


ar40 


07032 


fe79 


dO cd 




bne 


ar20 


07033 


fe7b 


ad 77 43 


Ida 


nbteinp 


07034 


fe7e 


c5 05 




cmp 


tl 


07035 


feSO 


90 c6 




bcc 


ar20 


07036 


fe82 


a9 01 




ar40 Ida #$01 


07037 


fe84 


20 ef 


fO 


jar 


drdbyt 


07038 


fe87 


18 




clc 




07039 


fe88 


69 01 




adc 


#$01 


07040 


feSa 


a6 15 




Idx 


lindx 


07041 


feSc 


95 69 




sta 


nr,x 


07042 


feSe 


20 bO 


d6 


jsr 


nxtts 


07043 


£e91 


20 f d 


f8 


jsr 


setlnk 


07044 


fe94 


a5 lb 




Ida 


r2 


07045 


fe96 


dO 15 




bne 


arSO 


07046 


fe98 


20 60 


f9 


Jsr 


wrtout 


07047 


fe9b 


20 d6 


eb 


ar45 jsr 


dblbuf 


07048 


fe9e 


20 94 


ec 


Jsr 


sethdr 


07049 


feal 


20 bO d6 


jsr 


nxtts 


07050 


fea4 


20 f d 


f8 


Jar 


setlnk 


07051 


fea7 


20 ca 


fd 


Jar 


nulbuf 


07052 


feaa 


4c b9 


fe 


J">p 


ar55 


07053 


fead 










07054 


fead 


20 d6 


eb 


ar50 jsr 


dblbuf 


07055 


febO 


20 94 


ec 


Jar 


sethdr 


07056 


feb3 


20 ca 


fd 


Jar 


nulbuf 


07057 


feb6 


20 19 


f9 


Jar 


nullnk 


07058 


feb9 


20 60 


f9 


ar55 jsr 


wrtout 


07059 


febc 


20 Oc 


f9 


Jar 


getlnk 


07060 


febf 


a5 13 




Ida track 


07061 


feci 


48 




pha 




07062 


fec2 


a5 14 




Ida 


sector 


07063 


fec4 


48 




pha 




07064 


fec5 


20 3e 


f9 


jar 


gethdr 


07065 


fec8 


a5 14 




Ida 


sector 


07066 


feca 


48 




pha 




07067 


fecb 


a5 13 




Ida 


track 


07068 


feed 


48 




pha 




07069 


fece 


20 47 


fa 


Jar 


gsspnt 


07070 


fedl 


aa 




tax 




07071 


fed2 


dO Oa 




bne ar60 


07072 


fed4 


20 33 


ff 


Jar 


newss 


07073 


fed7 


a9 10 




Ida #ssioff 


07074 


fed9 


20 eb 


f9 


Jsr 


setssp 



compare 



Is 0, branch, else 

check if enough blocks left: 

with 

hi byte of NBTEMP+1 then branch if 

more than enough 

not enough. Else if just enough, 

better check lo 

number of blocks free (lo byte 0/1) 



if not enough, abort 

sector link 

look at sector link 

position) 



(.A 



gives NR 

log. index/channel number 
next record pointers table 
Next available track and sector 
Put TRACK & SECTOR into header 

if add-1-block flag is set 

write current last record 

Toggle buffers 

Set up header for active buffer 

Get another 

Set up link 

Clean it out 



Switch buffers 

Set up header from T/S 

Clean buffer 

Set track link to 0, sector link to 

last non-0 char in buf 

write buffer 

get track & Sector from link 

save them 



now get track and sector from header 
current sector number 

current track number 

Get side sector pointers 



Create a new side sector, change the 
old to reflect it 

Use side sector pointer to set 
DIRBUF & BUFTAB 



nulbuf , newss , vectors , checksum 



page ..149 



line addr object source code 



07075 fedc e6 19 

07076 fede 68 

07077 fedf 20 95 f8 

07078 fee2 68 

07079 fee3 20 95 f8 

07080 fee6 68 

07081 fee7 85 U 

07082 fee9 68 

07083 feea 85 13 

07084 feec fO Of 

07085 feee a5 19 

07086 fefO c5 83 

07087 fef2 dO a7 

07088 fef4 20 47 fa 

07089 fef7 c5 84 

07090 fef9 90 aO 

07091 fefb fO bO 



ar60 



07092 


fefd 


20 47 


fa 


07093 


ffOO 


48 




07094 


ffOl 


a9 00 




07095 


ff03 


20 de 


f9 


07096 


ff06 


a9 00 




07097 


ff08 


a8 




07098 


ff09 


91 27 




07099 


ffOb 


c8 




07100 


ffOc 


68 




07101 


ffOd 


38 




07102 


ffOe 


e9 01 




07103 


fflO 


91 27 




07104 


ffl2 


20 6e 


f9 


07105 


ffl5 


20 87 


ec 


07106 


ffl8 


20 55 


f6 



07107 ffib 20 b3 ea 

07108 ffle 20 d6 eb 

07109 ff21 20 fa f9 

07110 ff24 70 03 



07111 


ff26 


4c 58 fd 


07112 


ff29 




07113 


ff29 


a9 80 


07114 


ff2b 


20 bO ed 


07115 


ff2e 


a9 50 


07116 


ff30 


20 c9 db 


07117 


ff33 




07118 


ff33 





ar65 



ar70 



inc rO 

pla 

jsr putss 

pla 

Jsr putss 

pla 

sta sector 

pla 

sta track 

beq ar65 

Ida rO 
cmp ssnuffl 
bne ar45 

jsr gsspnt 
cmp ssind 
bcc ar45 
beq ar50 

jsr gsspnt 

pha 

Ida #$00 

jsr ssdlr 

Ida #$00 

tay 

sta (dirbuf),y 

iny 

pla 

sec 

sbc #$01 
sta (dirbuf),y 
jsr wrtss 
jsr watjob 
jsr mapout 

jsr fndrel 
jsr dblbuf 
Jsr sspos 
bvs ar70 

jmp posltn 

Ida #lrf 

jsr getpre 
Ida #norec 
jsr cmderr 



advance side sector count 

track 

put byte into side sector 

sector 

put byte into side sector 

sector link 

current sector number 

track link 

current track number 

if 0, there are no more blocks in 

this file 

count 

side sector number 

if unequal, not enough blocks done 

yet 

Get side sector pointers 

(end) pointer in side sector 

if SSIND>.A, we're almost done 

if equal, one more block left 

else the job is done 
Get side sector pointers 

Use side sector pointer to set 

DIRBUF 

zero ,A and .Y: zero track link of 

s-s sector 

directory buffer pointer 

pull this sector's pointer, 

subtract 1, and store the result as 

the 

sector link of the s-s sector in 

directory buffer pointer 

and write the side sector 

Wait until job is completed 

Write out BAM to drive specified in 

LSTJOB 

Find relative file 

Get back toleading buffer 

Use SSNUM & SSIND to set SS & BUFTAB 

if V set, record is still beyond end 

of relative file 

Position to record 

beyond end, so signal last record 

flag 

Set buffer pointers 

record not present error 

Command level error handling 



nulbuf , newss , vectors , checksum 



page ..150 



line 


addr 


object 


source 


code 




07119 


ff33 


=> Create a new 


side sector, change the old to re£lect it < 


07120 


f£33 










07121 


£f33 


20 bO d6 newss 


Jsr nxtts 


Next track and sector based on 












header 


07122 


ff36 


20 d6 


eb 


jar dblbu£ 


use inactive bufe£r 


07123 


ff39 


20 £1 


£8 


jsr scrub 


Write out bu££er i£ dirty 


07124 


ff3c 


20 95 


£a 


jsr getact 


Get active bu££er number 


07125 


ff3f 


48 




pha 


active bu££er number 


07126 


ff40 


20 c3 


£9 


jsr clrbu£ 


Clear bu££er 


07127 


f£43 


a6 15 




Idx lindx 


log. index/channel number 


07128 


ff45 


b5 79 




Ida ss,x 


set registers £or trans£er 


07129 


££47 


a8 




tay 


buf£er number with side sectors 


07130 


££48 


68 




pla 




07131 


££49 


aa 




tax 




07132 


££4a 


a9 10 




Ida #ssio££ 


number of characters 


07133 


f£4c 


20 a7 


£9 


jsr bOtobO 


Move bytes between buffers 


07134 


££4f 


a9 00 




Ida #$00 


point to start of the old side 
sector buffer 


07135 


££51 


20 de £9 


jsr ssdlr 


Use side sector pointer to set 












DIRBUF 


07136 


££54 


aO 02 




Idy #$02 




07137 


££56 


b1 27 




Ida (dirbu£),y 


get side sector number 


07138 


££58 


48 




pha 




07139 


££59 


a9 00 




Ida #$00 




07140 


f£5b 


20 cl 


£0 


jsr setpnt 


Set up pointer into active data 
buffer 


07141 


£f5e 


68 




pla 


side sector number 


07142 


ff5£ 


18 




clc 




07143 


££60 


69 01 




adc #$01 


add 1, then store in the new 


07144 


££62 


91 27 




sta (dirbu£),y 


side sector 


07145 


££64 


Oa 




asl a 


multiply by 2 


07146 


££65 


69 04 




adc #$04 




07147 


££67 


85 Ic 




sta r3 


save position 


07148 


££69 


a8 




tay 




07149 


££6a 


38 




sec 




07150 


££6b 


e9 02 




sbc #$02 


subtract 2 


07151 


££6d 


85 Id 




sta r4 




07152 


££6£ 


a5 13 




Ida track 


current track number 


07153 


££71 


85 la 




sta rl 


save for side sector update 


07154 


££73 


91 27 




sta (dirbu£),y 


put track in side sector 


07155 


££75 


c8 




iny 




07156 


££76 


a5 14 




Ida sector 


current sector number 


07157 


f£78 


85 lb 




sta r2 


save for side sector update 


07158 


££7a 


91 27 




sta (dirbu£),y 


put sector in side sector 


07159 


££7c 


aO 00 




Idy #$00 


to set track link at start of n 
side sector at 


07160 


££7e 


98 




tya 




07161 


££7f 


91 27 




sta (dlrbuf),y 


null link 


07162 


££Bl 


c8 




iny 




07163 


££82 


a9 n 




Ida #ssio£f-i-l 


indicating that the last non-ze 



07164 ££84 



character 

in the buffer is the one following 

the side sector offset 



nulbuf , newss , vectors , checksum 



page ..151 



line addr object source code 



07165 
07166 
07167 

07168 
07169 
07170 
07171 
07172 
07173 
07174 
07175 
07176 
07177 
07178 
07179 
07180 
07181 
07182 
07183 
07184 

07185 
07186 
07187 
07188 
07189 
07190 
07191 
07192 
07193 
07194 
07195 
07196 
07197 
07198 
07199 
07200 
07201 
07202 
07203 
07204 
07205 
07206 
07207 
07208 

07209 
07210 

07211 
07212 
07213 



ff84 
ff86 
ff88 

ffSb 
ffSe 
ff91 
ff91 
ff91 
ff91 
ff93 
ff95 
ff96 
ff99 
ff9b 
ff9d 
ff9e 
ffal 
ffa3 
ffaS 
£fa8 

ffaa 
ffac 
ffae 
ffaf 
ffbl 
ffb3 
ffb6 
ffb6 
ffb9 
ffbb 
ffbe 
ffcO 
ffc3 
ffc5 
ffc7 
ffc9 
ffcb 
ffcd 
ffce 
ffdO 
ffd2 
ffd5 
ffd8 
ffda 

ffdc 
ffde 

ffel 
ffel 
ffe4 



91 27 
a9 10 
20 cl 



fO 



20 52 f9 
20 87 ec 



sta (dirbuf),y 
Ida #$10 
Jsr setpnt 

jsr wrtab 
jsr watjob 



directory buffer pointer 

side sector offset 

Set up pointer into active data 

buffer 

Do read and write jobs 

Wait until job is completed 



Finished creating new block. Now revise old one to reflect the new. 



a6 15 

b5 79 

48 

20 aO fa 

a6 15 

95 79 

68 

ae 49 43 

95 49 

a9 00 

20 cl fO 

aO 00 

a5 13 
91 27 
c8 

a5 14 
91 27 
4c c3 f£ 

20 95 fa 
a6 15 
20 Id fa 
a9 00 
20 cl fO 
c6 Id 
c6 Id 
a4 Ic 
a5 la 
91 27 
c8 

a5 lb 
91 27 
20 60 f9 
20 87 ec 
a4 Id 
cO 03 

bO d8 
4c d6 eb 



ns20 Idx lindx 
Ida 38, X 
pha 

jsr gaflgs 
Idx lindx 
sta ss,x 
pla 

Idx Ibused 
sta bufO,x 
Ida #$00 
jsr setpnt 
Idy #$00 

Ida track 

sta (dirbuf),y 

iny 

Ida sector 

sta (dirbuf),y 

jmp nsSO 



ns40 



ns50 



jsr 
Idx 
jsr 
Ida 
jsr 
dec 
dec 
Idy 
Ida 
sta 
iny 
Ida 
sta 
jsr 
Jsr 
Idy 
cpy 



getact 

lindx 

ibrd 

#$00 

setpnt 

r4 

r4 

r3 

rl 

(dirbuf),y 

r2 

(dirbuf),y 

wrtout 

watjob 

r4 

#3 



bcs ns40 
jmp dblbuf 



6c fO 10 nmi jmp (vnmi) 



log. index/channel number 
get side sector buffer number 

Get active buffer and set LBUSED 

log. index/channel number 

swap active buffer and side sector 

last buffer used 

for start of buffer 

Set link to new side sector 

to set track link, point to new side 

sector block 

current track number 

directory buffer pointer 

current sector number 
directory buffer pointer 



Get active buffer number 
log. index/channel number 
read next side sictor 

pointer = 



get new side sector link pointer 
put track in 



put sector in 
write it back 
Wait until job is completed 

if Y >3 there are more side sectors 
to update 

Double buffer: switch 
active/inactive buffers 

$10f0 



nulbuf , newss , vectors , checksum 



page ..152 



line addr object source code 

07215 ffe4 =«-»> copyright notice <== 

07216 ffe4 

07217 f£e4 43 42 4d cbmdos .byte 'cbni80',$a 

07218 ffe7 38 30 ae 



07220 ffea 



* - $ffe9 



07222 ffe9 00 



fchksm .byte f-rom checksum 



07224 


ffea 


05 ea 


ublock .word ublkrd 


Ul 


07225 


ffec 


3d ea 


.word ublkwt 


U2 


07226 


ffee 


00 13 


.word $1300 


U3 


07227 


fffO 


03 13 


.word $1303 


U4 


07228 


fff2 


06 13 


.word $1306 


U5 


07229 


fff4 


09 13 


.word $1309 


U6 


07230 


£ff6 


Oc 13 


.word $130c 


U7 


07231 


fffS 


Of 13 


.word $130f 


U8 


07232 


fffa 








07233 


fffa 




*-$fffa 





07235 fffa 



07236 fffa 

07237 fffa el ff 

07238 fffc 2b d3 

07239 fffe Ob d5 

07239 0000 

07240 0000 

errors in pass 1 >> 00000 
errors in pass 2 > 00000 

assembly completed 



-> NNMI ROM routine ($ffel) <- 



.word nmi 
.word dsklnt 
.word atnlrq 

.end 



NMI 

start/reset 
IRQ - UJ, U: 



crossreference 

page ..153 

label address line numbers 

acc200 = $eb8b: 3992, 4036 

accum = $22: 212. 3908. 3915. 3927. 3930. 3932, 3934. 3936. 3939 

ftt\' ?^^^' ^^"' 3979. 3980. 3985. 3988, 3990. 3998 

4000, 4001. 4003. 4005, 4006. 4007. 4009, 4018. 4036 

accx2 = $eb8a: 3947.' 3994,' 4030, 4035 

accx4 = $eb87: 3997, 4030 

actjob = $10a0: 172 

adlO - $dd23: 1928, 1937 

addlOO = $eb95: 4046. 4050 

addfil - $fla9: 3181. 5036. 5413 

addnr = $fdec: 6401. 6824. 6829, 6840 

addrel = $fe04: 6519, 6859 

addres = $eb92: 3946, 3993, 4044 

addrts = $fa67: 6303, 6305 

addtl2 = $fa5e: 6293, 6298, 6300 

adrsed = $10: 191, 790, 798, 807 

af08 = $fld9: 5055, 5061 

aflO = $flea: 5062. 5069 

afl5 = $flf4: 5059. 5073 

af20 = $f20l: 5060. 5064. 5067, 5072. 5078 

af25 = $f210: 5083, 5085 

af30 = $£232: 5100, 5103 

af50 = $f252: 5106, 5116 

again = $ec7f: 4161, 4192 

ahlO = $e946: 3670, 3685 

ah20 = $e965: 3672, 3674, 3686 

ahSO = $e96b: 3689, 3694 

ah35 = $6972: 3693. 3696. 3699 

ah40 = $e97f: 3691. 3700 

alldrs = $ddle: 1926, 2748. 2993, 3258, 5514 

an05 = $feOO: 6843. 6847, 6852 

anlO = $fe03: 6846, 6854 

ap30 = $f4f7: 5456, 5459 

apmode = $02: 63. 5351. 5368 

append = $f4df: 3165. 5370. 5448, 5451 

arlO = $fe3a: 6878, 6881, 6886 

ar20 = $fe48: 6893. 6918. 6921 

ar25 - $fe4d: 6892. 6895 

ar30 = $fe57: 6898, 6901 

ar35 = $fe74: 6911, 6914, 6916 

ar40 = $fe82: 6917, 6922 

ar45 = $fe9b: 6933, 6973, 6976 

ar50 = $fead: 6931, 6940, 6977 

ar55 = $feb9: 6938, 6944 

ar60 = $fede: 6957, 6962 

ar65 = $fefd: 6970, 6978 

ar70 = $ff29: 6996, 6999 

aschex = $e93c: 3655, 3665 

atnlO = $d51e: 756. 822 

atn20 = $d526: 759. 761 

atn30 = $d52f: 760. 763 

atn40 = $d5a2: 783. 791, 799, 808, 817, 820. 821 



crossreference 



page ..154 



label 



address line numbers 



atn50 


= $d5aa: 


762. 


824 








atn60 


"'$d5bd: 


825, 


833 








atn70 


» $d5cd: 


837, 


840 








atna 


- $01: 


140, 


756, 


826. 


833 




atnl 


- $80: 


147 










atnirq 


» $d50b: 


748, 


7124 








atnnd 


= $0284: 


156 










atnne 


= $0286: 


158 










atnpd 


» $0285: 


157 










atnpe 


= $0287: 


159, 


684. 


750 






autofg 


- $10f3: 


176, 


2117 








autolt 


= $ddc8: 


2045, 


2061, 


2119. 


2126 




avl 


» $d7aO: 


1093, 


1097 








av2 


= $d7bl: 


1020, 


1065, 


1102, 


3727 




av3 


= $d7b3: 


1101, 


1103, 


1107 






av4 


= $d7bc: 


1100, 


1108 








avail 


= $d795: 


1019, 


1064, 


1086, 


3726 




avck 


- $d7bd: 


1098, 


1113. 


5677 






avck3 


= $d7c3: 


1116, 


1118 








avck4 


= $d7c4: 


1117, 


1119, 


1122 






avck5 


= $d7c9: 


1115, 


1120 








avck6 


= $d7da: 


1124, 


1128 








b02 


= $f9bb: 


6182, 


6185 








bOtobO 


- $f9a7: 


6171 , 


7019 








balO 


= $e9a3: 


3726, 


3743 








ba20 


= $e9a6: 


3727, 


3734 








ba30 


= $e9ca: 


3741, 


3745 








ba35 


= $e9cc: 


3746, 


3750 








ba40 


= $e9dl: 


3728, 


3749 








badbch 


= $05: 


99 










badblk 


=. $0a: 


103 










badbyt 


- $10: 


105 










badcmd 


= $31: 


1196, 


1658. 


3485, 


3592 




badfn 


= $33: 


1198, 


2662. 


5289 






badhch 


=> $09: 


102 










badld 


> $0b: 


104 










badsyn 


- $30: 


1195, 


1808, 


3007, 


3018, 3595, 5202 




badts 


- $66: 


1209, 


4975 








bamO 


= $4100: 


55, 


4955 








baml 


- $4200: 


56, 


4957 








bamjob 


> $0c: 


54. 


57, 


57, 


2701, 3538, 3866, 5687 


bcd2 


- $d9ca: 


1414, 


1416 








bcddec 


» $d9cl: 


1409, 


1435 








bcjmp 


= $e8fe: 


3614, 


3616, 


3627 






bctab 


> $e8f8: 


3602, 


3623, 


3625 






be05 


= $ea4e: 


3835 










belO 


o $ea5d: 


3839, 


3842 








bfcnt 


- $0c: 


53, 


54. 


274, 


276, 595, 619, 621, 720 


bhlO 


- $fdc4: 


6808, 


6810 








bhere 


> $fdb8: 


6776, 


6783, 


6804 






bigfil 


- $52: 


1202, 


6893 








bkotst 


> $ea95: 


3757, 


3804, 


3826, 


3881 




blklO 


> $e8cl: 


3592, 


3606 









crossreference 



page ..155 



label address line numbers 



blkSO 

blk40 

blk50 

blk60 

blkalc 

blkexc 

blkfre 

blknb 

blknbl 

blkpar 

blkptr 

blkrd 

blkrd2 

blkrdS 

blktst 

blkwt 

block 

bmask 

bmpnt 



bp05 

bptO 

bp20 

break 

bt05 

btl5 

bt20 

bufO 

bufi 

bufind 

bufs 

buftab 



= $e8c6: 
= $e8cb: 
= $e8d3: 
= $e8dd: 
= $e999: 
= $ea49: 
= $6990: 
= $ela9i 
= $elad: 
= $e90a: 
= $ea60: 
= $e9fc: 
= $e9dcz 
= $e9e8: 
= $ea98: 
= $eal9: 
= $e8b6: 
= $ebce: 
- $02: 



$e917: 
$e926: 
$e92d: 
$fce5: 
$eaab: 
$ea83: 
$ea88: 
$49: 

$51: 

$fOff 

$1100 

$29 



buftst 
bufuse 

bump 

bwlO 

bw20 

catidl 

catid2 

catid3 

catid4 

cb 



$ea75: 
$433e: 

$cO: 
$ea27: 
$ea32: 
$deOd: 
$ddd8: 
$dddb: 
$ddee : 

$45: 



3595 

3591 
3602 
3603 
3627 
3631 
3628 
2531 
2600 
3610 
3632 
3629 
3757 
3770 
3716 
3630 

350 
1472 

184 
1094 
2717 
4060 
3536 
3645 
3649 
6666 
3742 
3868 
3867 

220 
4531 

221 
5851 

591 

177 

218 
1533 
3764 
4413 
4794 
5857 
6566 
3847 

258 
4606 
88 
3809 
3817 
2073 
2052 
2049 
2051 

219 



3599, 

3598 

3605 

3607 

3722 

3833 

3716 

2598, 

2602 

3637, 

3847 

3782 

3770, 

3782, 

3722, 

3804 

354, 
4059, 

959, 
1120, 
2843, 
4062, 
3641, 
3647, 
3655 
6680, 
3891 
3873 
3871 

614, 
4572, 

615, 
5853, 
3837, 

513, 

219, 
1553, 
3852, 
4414, 
4795, 
6077, 
6569, 
3860, 

634, 
4607, 

680, 
3811 



3660 



2608, 
3793, 



3833 
3794 
3882 

3587 
4085, 
961, 
1471, 
2860, 
4064, 
3643, 
3650, 



2644 
3825 



4091 
966, 
1473, 
3395, 
4084 
3652 
3659 



1043, 1051, 1079, 1081, 1090 
1475, 1477, 2689, 2696, 2710 
3398, 3410, 3421, 3725, 4058 



6691, 6759 



620, 
4577, 
4100, 
6353, 
4908, 
2952, 

589, 
1569, 
4242, 
4484, 
4797, 
6232, 
6573, 
3881 

636, 
4623, 

682, 



622, 
5841, 
4102, 
6368 
4917, 
2954, 

592, 
1570, 
4243, 
4733, 
4873, 
6234, 
6577 

3549, 
4624, 
4170 



3564, 3574, 4097, 4099, 4521 

5846, 6351, 6362, 6545, 6554, 7067 

4522, 4536, 4581, 4586, 5843 



5718, 6175, 
2956 

598, 601, 

1578, 2430, 

4322, 4403, 

4737, 4738, 

4876, 4896, 

6397, 6413, 



6177, 6192, 6218 

604, 607, 1532 

2432, 2706, 3579 

4405, 4409, 441 1 

4739, 4741 , 4781 

4898, 5527, 5850 

6467, 6468, 6482 



3552, 3555, 3556, 3558, 3559 
4636, 4637 



2076, 2081 

2055 

2054 

2063 

1277, 1286, 1294, 1352, 1418, 1432, 1434, 1437 



crossreference 



page ..156 



label 



cblO 

cbmdos 

cbav2 

cbptr 

cclO 

cc15 

cc20 

cdelay 

cdirty 

char 

chlcln 

chkio 

chndat 

chnrdy 



cjumph 

cjumpl 

cklO 

ck20 

ck25 

ck30 

ckml 

ckm2 

cktl 

ckt2 

cktm 

cld2 

cldchn 

close 

clrtO 

clrb2 

clrbuf 

clrcl 

clrcb 

clrchn 

dree 

clrflO 

clrflg 

cl305 

clslO 

cls20 

clsall 

clsc28 

clsc30 

clsc31 

clschn 

dsd 

clsd4 

clsd5 



address line numbers 



= $f9ce: 
= $ffe4: 

- $73: 

- $lc: 
= $dfc4: 
■> idfca: 
= $dfd4: 
= $d393: 

- $£bf6: 
= $437b: 
= $e6c3: 
° $e6eO: 
= $b5: 

=. $98: 



$d2b7: 
$d2ac: 
$e6cd: 
$e6d£: 
$e6e3: 
$e6ef : 
$f4c7: 
$f4d2: 
$f4d4: 
$f4de: 
$f4bf: 
$ef74: 
$ef54: 
$f58d: 
$£bea: 
$dbc2: 
$f9c3: 
$e£4c: 
$dbbe: 
$ef48: 
$fbd9: 
$£8ab: 
$£8a5: 
$£599: 
$f59c: 
$£5bO: 
$f5ac: 
$f5c3: 
$f5dd: 
$f5e0: 
$f5ba: 
$e£58: 
$£707: 
$£722: 



1445 
2017 
6197 
7103 

670 

57 

2228 

2317 

2322 

519 
6149 

285 
3149 
3176 

245 
5521 

241 
3245 
5462 

353 

349 
3298 
3300 
3312 
3314 
5432 
5433 
5438 
5439 
5223 
4663 
2861 

818 
6531 
1693 
5899 
4650 
1344 
4648 
6505 
5962 
5955 
5538 
5534 
5553 
5541 
5564 
5571 
5575 
3203 
4660 
5739 
5724 



1450, 1459. 1650, 1681, 1831, 1868, 1894, 1982 

3477, 3479, 4772 

6199 



1213, 

218, 
2316, 
2320 
2324 

520, 
6551 
1651, 
3293, 
3267, 

924, 
5831, 

630, 
3573, 
5833, 

357, 
1666 
3303 
3306 
3319 
3318 
5435 
5437 
5441 
5443 
5229, 
4671, 
4274, 
5533 
6537 
1695 
6191, 
4652 
1686, 

6529, 

5970 

5967, 

5545 

5540 

5555 

5551 

5567 

5578 

5579 

5542, 

4674 

5745 

5761 



5009 

219, 5527 
2323 



524 



1654, 1828, 1833 

3311 

3311 

1440, 3575, 3796, 4699, 4740, 4750, 4785 

6574, 6593 

632, 850, 918, 927, 1461, 1557, 1606 

3776, 4427, 4713, 4720, 4724, 4745, 4783 

5883, 6576, 6583, 6595, 6721 
1668 



5429 
4673 
4658 



7012 
1691 



6535 

6378, 6400, 6523, 6706 



5553, 5561 



crossreference 

page ..157 

label address line numbers 




cmdbuf 



cmdchn = 



I960 
3021 
3468 
5281 



cmdchn = $06: 60, 620, 625, 630, 4139 

cmder2 = $d95c: 1025, 1070, 1127, 1343, 1704, 3747, 4976, 5010, 5744, 6692 

cmder3 = $d95f! 1340, 1344 



cniderr » $dbc9: 



1340; 1344 • • ' ' "• "'^• 

983, 1056, 1659, 1676, 1701, 1758, 1809, 1887, 2663 

3008, 3019, 3158, 3305, 3316, 3486, 3533, 3593, 3596 

3869, 4237, 4529, 4685, 5203, 5287, 5290, 5329, 5338 

5346, 5391, 6509, 6597, 6703, 6710, 6894, 7002 



Jisa, SM5, 3316, 3486, 3533, 3593, 3596 

4529, 4685, 5203, 5287, 5290, 5329, 5338 

—"-• ""'" ^^^' ^597, 6703, 6710, 6894, 7002 

cmdlnd = $le: 107 

cmdlen = $3a! Ill, 253, 1691, 1882 

cmdnum - $437a: 284, 1332, 1336, 1661, 1665, 1802, 1885, 3609, 3611 

5143, 5473 

cmdrst = $dcdf: 1884, 1892, 5507 

cmdsa = $0f: 62, 626, 1358 

cmdset » $dcb6: 1649, 1868, 5142, 6697 

cmdsiz . $4379: 283, 1829, 1854, 1881, 1986, 1988, 2461, 2673, 2985 

3041, 3042, 3454, 3525, 3651, 3684, 5474 

cmdtbl - $d2al: 343, 347, 1653 

cmdwat = $4347: 263, 689, 693, 4150 

cmpchk = $dfb9: 2224, 2303, 2312 

code - $d000: 336, 2951, 2953, 2955 

compar - $df04: 2162, 2203, 2220 

copOl = $e5b8: 3154, 3157 

cop05 - $e5bd: 3156, 3159 

coplO = $e5d4: 3138, 3141, 3144, 3170 

copy - $e58e: 3013, 3135 

cp02 = $dfl2: 2226, 2229 

cp05 - $df13: 2228, 2235, 2238, 2249, 2252, 2265 

cplO - $dfl8: 2225, 2230 

cp20 - $df2a: 2233, 2239 

cp30 - $df36: 2245, 2260 

cp32 - $df47: 2247, 2253 

cp33 = $df49: 2243, 2255 

cp34 - $df57: 2256, 2261 

cp40 - $df61: 2259, 2262, 2266 

cp42 - $df91: 2287, 2289 

cp50 - $dfb9: 2311 

cpydl = $e399: 2869, 2877 

cpydtd - $e4cf: 3005, 3038 



crossreference 



page ..158 



label 



address line numbers 



cpytrk 


= 


$e3b3: 


2873, 


2884, 


2888 














cr 


a 


$0d: 


51. 


1873, 


1877, 


4767, 


5617, 


6415, 


6592 






cr20 


zz 


$d3a0: 


522, 


530 
















cr30 


s> 


$d3a2: 


531, 


569 
















cs07 


3 


$dccd: 


1871, 


1880 
















cs08 


= 


$dcce: 


1869, 


1874, 


1878, 


1881 












cslO 


a 


$dcff: 


1905, 


191 
















ctbslz 


a 


$07: 


110, 


170, 


404, 


404, 


664 










curblk 


_ 


$f93b: 


2358, 


2399, 


4840, 


5046, 


5321, 


5362, 


6087 






cy 


. 


$eSda: 


3101, 


3170, 


3176 














cylO 


= 


$e5ec: 


3167, 


3183, 


3200 














cyl5 


s 


$e5f9: 


3189, 


3193 
















cy20 


s 


$e5fc: 


3187, 


3190 
















cy30 


a 


$e60e: 


3195, 


3197 
















daco 


s 


$02 1 


HI, 


756, 


771, 


833, 


863, 


874, 


900 






data 


a 


$18: 


199, 


770, 


775. 


784. 


801, 


809, 


898, 


1558, 


1601 








1607, 


3243, 


3453, 


4128, 


4134, 


4144, 


4423, 


4428, 


4445 








4451, 


4768, 


4776, 


4784, 


6398, 


6416, 


6466, 


6494, 


6517 








6521, 


6533, 


6588 














davl 


a 


$40: 


146 
















• 


davo 


a 


$10: 


144, 


463, 


751, 


928, 


934, 


944, 


1373 






dblbuf 


= 


$ebd6: 


4096, 


4304, 


4307, 


4431, 


4440, 


4444, 


4471, 


5585, 


5622 








5639. 


6438, 


6446, 


6454, 


6456. 


6617, 


6622, 


6624, 


6782 








6788, 


6790, 


6933, 


6940, 


6994, 


7008, 


7096 






dcde 


a 


$d54a: 


774 


















dcde20 


a 


$d55e: 


780, 


784 
















dcde30 


a 


$d56a: 


788, 


790, 


803 














dcdeAO 


a 


$d56f: 


786, 


793 
















dcdeSO 


a 


$d573: 


795, 


806 
















dcde60 


a 


$d57d: 


778, 


800 
















dcde70 


a 


$d58b: 


782, 


807 
















dcde80 


a 


$d5a2: 


819 


















dchksm 


a 


$d2a0: 


338 


















dectab 


a 


$e98d: 


3695, 


3711 
















dell 


a 


$e33c: 


2814, 


2818 
















del2 


a 


$e323: 


2807 


2820 
















deldir 


a 


$e345: 


2769 


2825, 


3366, 


5272 












delfil 


a 


$e31d: 


2777 


2792, 


2805, 


5758 












delind 


= 


$4398: 


309 
5057 


2147, 
5070, 


2188, 
5077, 


2362, 
5078, 


2363, 
5125 


2368, 


3068, 


3078, 


3330 


delsec 


a 


$4397: 


308 


2333, 


2356, 


2360, 


3127, 


5061, 


5075, 


5122 




dlagok 


a 


$d3dc: 


574 


638, 


640 














dirl 


a 


$da9f: 


1536 


1548, 


1610 














dirlO 


a 


$dac2: 


1549 


1582 
















dir3 


a 


$dad8: 


1540 


1561 
















dlrbuf 


a 


$27: 


213 


2246, 


2250, 


2263, 


2279, 


2296, 


2300, 


2305, 


2354 








2361 


2397, 


2418, 


2431, 


2433. 


2436, 


2516, 


2521, 


2532 








2566 


2616, 


2618, 


2620, 


2625, 


2730, 


2733, 


2737, 


2740 








2765 


2771, 


2775. 


2827. 


3109. 


3343, 


3346. 


3349, 


3353 








3364 


4485, 


4764. 


4874, 


4877. 


4897, 


4899. 


5100, 


5109 








5112 


5115, 


5309, 


5311, 


5314, 


5317, 


5355, 


5357, 


5377 








5380 


5383, 


6039, 


6042, 


6049, 


6052, 


6061, 


6068, 


6078 








6080 


, 6208, 


6214, 


6219, 


6272, 


6275, 


6324, 


6338, 


6339 



crossreference 



page ..159 



label address line numbers 



dirent 

direrr 

dlrlen 

dirlst 

dlrsec 

dirtyp 

divlOO 

divl20 

divlSO 

div200 

div254 

div300 

div400 '■ 

div500 

dlv600 

dlv700 '■ 

doit 

doit2 : 

dosver ' 

drdbyt ■■ 

drt 

drtrd ■ 

drtwrt ' 

drvcnt ■■ 

drvflg : 

drvnum - 



■■ $436b: 
$71: 
$18: 
$4346: 
$4396: 
$07: 
$eblc: 
$ebl6: 
$eb2c: 
$eb2e: 
$eb13: 
$eb48: 
$eb55: 
$eb64: 
$eb7b: 
$eb7d: 
$fl9d: 
$f1aO: 
$02: 
$fOef: 
$f05d: 
$f057: 
$f05b: 
$4392: 
$4393: 

$12: 



dskcpy 
dskful 
dskld 

dskinl 

dskln2 

dskint 

dupl 

duplet 

dxOOOO 

dxOOlO 

dx0020 

echksffl 

endcmd 



$e454: 

$72: 

$4340: 

$d41f: 
$d426: 
$d32b: 
$e371 : 
$e350: 
$e476: 
$e499: 
$e49e: 
$e7ae: 
$db9f: 



endlt = $e520: 



6639 

6828 

7072 

277 

1024 

108 

262 

307 

68 

3969 

3910 

3978 

3979 

3907 

3987 

3996 

4002 

4014 

4012 

4272 

4817 

77 

2349 

4806 

3758 

2713 

303 

304 

3070 

193 

2003 

2293 

2961 

4260 

5133 

5775 

351 

982 

259 

2855 

610 

614 

456 

2845 

349 

2978 

3007 

2996 

3430 

1675 

3582 

4258 

3054 



6660, 
6984, 
7075, 
5129, 
1069, 
2514, 
1556, 
2377, 
3580, 
3976 
3966 
4008 
3983 
3964 
3993 
3998 
4004, 
4016, 
4019 
4280, 
5029, 
2736 
4905, 
4812 
4805, 
2741, 
2054, 
2087, 
3076 
957, 
2058, 
2611, 
3125, 
4270, 
5155, 
5790, 
355, 
1055, 
2072, 
2856, 
612 
618 
7123 
2848 
353, 
2992 
3012 
3000, 



6667, 
6989, 
7087, 
5320, 
1125, 
2519, 
4753, 
2401, 
3580, 



6678, 

7023, 

7090 

5403, 

1211 

2523 

5536 

3056, 

4717, 



6679, 6682, 6772, 6774, 6821 
7030, 7040, 7044, 7047, 7051 

5700, 6017 



3090 
5570 



4006 
4018 

5028, 5691, 
6280 

6405, 6923 

5066, 5716 

3817, 3827, 

2057, 2110, 

2155, 2181, 



5776 



4811, 5116, 5322, 5363 

2120, 2150, 2194, 2237, 3120 

2491, 2497, 2499, 2501, 2509 



1077, 

2060, 

2666, 

3179, 

4278, 

5182, 

5840, 

2977 

1212 

2075, 

4223, 



2834 



3010 



1486, 
2068, 
2669, 
3211, 
4281, 
5193, 
5877, 



2676, 
4225, 



1515, 1615, 

2116, 2122, 

2699, 2726, 

3270, 3338, 

4495, 4618, 

5411, 5420, 

6147, 6268, 



1684, 1994, 2000 

2125, 2128, 2230 

2836, 2891 , 2930 

3723, 3885, 4220 

4670, 4812, 5051 

5494, 5522, 5710 

6270, 6714 



2678, 2729, 2732, 2853, 2854 
4285, 4287 



2742, 2879, 3074, 3168, 3171, 3288, 3340, 3508 

3718, 3752, 3784, 3799, 3821, 3828, 3840, 3855 

5165, 5371, 5424, 5546, 5556, 6746 
3074 



crossreference 



page ..160 



label 



address line numbers 



endrd 


= $£2ad: 


5163 


, 5184 








entfnd 


> $4345: 


261 


, 2167, 


2204, 


2221, 


2267, 


eoiflg 


- $a0: 


242 


, 767, 


895, 


3186, 


3247, 


eoii 


- $20: 


145 


. 766, 


894 






eoio 


' $08: 


143 


463, 


751, 


928, 


934, 


eoiout 


- $80: 


120 


125, 


1605, 


4426, 


4773 


eolsnd 


- $08: 


121 


3185, 


3246, 


4714 




erO 


- $d2e4: 


393 


6254, 


6326 






erOO 


- $d2e3: 


392 


6849 








erl 


- $d2e5: 


394 


6249, 


6344 






er2 


- $d2e6: 


395 


6329 








erS 


- $d2e7: 


396 


6341 








erblks 


- $434a: 


266 










ermsg2 


> $d9fa: 


1444 










errl 


- $d93e: 


1324 


1326 








err 10 


= $d9ae: 


1359 


1364, 


1388, 


1390 




err2 


- $d95b: 


1334 


1342 








errbuf 


- $43dc: 


323 
4778 


603, 
4780 


606, 


1431, 


1433, 


errchn 


= $07: 


58 


622, 


623, 


632, 


1440, 


errcnt 


- $435d: 


276 


4160, 


5018 






errend 


= $£9: 


1259 










errled 


- $20: 


152 


424, 


467, 


577, 


1348, 


errmsg 


- $d9dd: 


1338 


1343, 


1430, 


1682 




erroff 


= $da4b: 


1425 


1496, 


1683, 


4769 




error 


- $d925s 


1311 


2052, 


2970, 


4185 




errsa 


- $10: 


59 


624, 


4342 






errtab 


- $d7eb: 


1222 


1247, 


1259, 


1264, 


1272, 


errtok 


- $c4: 


1247 










errtsO 


= $d9d7: 


671 


1427, 


4771 






erword 


- $4373: 


278 


1346, 


1675, 


1807, 


1903, 


exec 


= $eO: 


90 


2962 








exlpO 


- $e4f8: 


3055 


3102 








flcnt 


- $437d: 


287, 


1773, 


1785, 


1795, 


1900, 






3094 


3098, 


3182, 


3299, 


3656, 


flptr 


- $81: 


229 


1898, 


1928, 


1931, 


3860, 


f2cnt 


- $437e: 


288 


1774, 


1790, 


1901, 


1917, 






2014 


2089, 


2314, 


2989, 


3004, 






3297 


5212, 


5484, 


5497 




f2ptr 


- $437£: 


289, 


1786, 


1899, 


1921, 


2266, 






3183, 


3197, 


3208, 


3218, 


3223, 


fchksm 


- $ffe9: 


7107 










fflO 


- $ded6: 


2178, 


2192, 


2202 






ffl5 


~ $debe: 


2180, 


2195 








££25 


= $dee6: 


2179, 


2190, 


2203 






ff30 


- $de£5: 


2205, 


2209 








££40 


- $d£03: 


2193, 


2208, 


2210, 


22T5 




£fre 


- $deb7> 


2177, 


2794, 


3072 






ffst 


- $dec9: 


2187, 


2752, 


3052, 


5215, 


5517 


£1103 


- $d4£ct 


732, 


736 








£1104 


- $d504: 


737, 


741 








£115 


- $d4et: 


721. 


727 








£116 


- $d4eb: 


722, 


726 









2335, 2387, 2489, 2782, 6012 
4146, 6496, 6513 

944 



1439, 1457, 4762, 4765 

1458, 1461, 3475, 4783, 4785 

1497 



1280 



3732, 3749, 6504, 6507, 6730 



1918, 2010, 2987, 3002 

3701, 5221, 5225, 5483, 5496 

3861 , 3882 

1920, 1936, 2011, 2013 

3095, 3100, 3136, 3199 

2315, 2316, 2320, 3151 

3657, 3686, 5349, 5393, 5401 



crossreference 



page ..161 



label address line numbers 



filcnt = $439b: 


312, 


2347, 


2352, 


2388, 


3062, 


3084 


flldat = $8b: 


239, 


1907, 


1934, 


2097, 


2114, 


2211, 




2660, 


2784, 


2835, 


3024, 


3030, 


3032, 




3177, 


3209, 


3224, 


3259, 


3261, 


3262, 




5049, 


5134, 


5157, 


5162, 


5241, 


5270, 




5409, 


5482, 


5493, 


6013 






fileOl = $d4c3: 


706, 


719 










file02 » $d4db: 


709, 


718 










filent = $86: 


238, 


1906, 


2277, 


3142, 


3143, 


3214, 




5127, 


5128, 


5318, 


5402, 


6018 




fllnop = $61: 


1204, 


4236 










filopn = $60: 


1203, 


5337 










filsec - $438b: 


296, 


1909, 


2301, 


2790, 


3537, 


3563, 




3883, 


3886, 


3888, 


5090, 


5397 




filtbl - $4380: 


294, 


1710, 


1716, 


1762, 


1784. 


1843, 




1932, 


1981, 


2015, 


2239, 


2672, 


2722, 




3049, 


3058, 


3088. 


3108, 


3128, 


3129, 




5256, 


5429, 


5498, 


5511 






filtrk = $4386: 


295, 


1848, 


1860, 


1908, 


2268, 


2271, 




2787, 


3121, 


3122, 


3301, 


3312, 


3703, 




5265, 


5275, 


5325, 


5394, 


5480, 


5500 


filtyp = $90: 


240, 


3581, 


4381, 


5164, 


5525, 


5708, 




5969, 


5970, 


5977, 


6009, 


6266, 


6712 


fixit = $e523: 


3053, 


3073, 


3076 








fl05 = $e0a8: 


2451, 


2462 










flic = $eOc3: 


2453, 


2455, 


2460, 


2463 






flexst = $63: 


1206, 


3315, 


5286 








flntfd = $62: 


1205, 


3304, 


5328 








fm2030 = $42: 


79, 


401 










fm2040 =. $41: 


78, 


400 










fnitl02 » $e422: 


2951, 


2958 










fmtlOS = $e443: 


2964, 


2965 










fmtno = $e453: 


2967, 


2972 










fndl = $d778: 


1065, 


1068 










fndlO = $ef7d: 


4679, 


4683 










fnd3 = $d786: 


1066, 


1072 










fnd30 = $ef8b: 


4680, 


4687 










fndc20 - $ed76: 


4338, 


4340 










fndc25 = $ed7c: 


4341, 


4343 










fndc30 = $ed88: 


4346, 


4351 










fndfil = $deel: 


2201, 


2207, 


2214, 


2591 






fndl 10 = $fc9a: 


6639, 


6645 










fndl20 = $fcab: 


6640, 


6650 










fndl30 = $fca7: 


6643, 


6646 










fndlmt = $e0al: 


2241, 


2409, 


2447 








fndlnx - $ef79: 


4511, 


4677 










fndlst = $fc95: 


6618, 


6627, 


6637 








fndnO - $d727: 


1009, 


1014, 


1016, 


1019 






fndnl = $d72a: 


1020, 


1030 










fndn2 - $d744: 


1021, 


1032 










fndn3 = $d723: 


1017, 


1031 










fndnS = $d739: 


1023, 


1027 










fndnxt - $d6fe: 


967, 


1000 











2231, 2292, 2295 

3123, 3139, 3140 

3265, 3268, 3293 

5293, 5335, 5340 



3219, 3271, 5124 



3705, 3851, 3862 

1855, 1905, 1929 

2982, 2997. 3038 

3283, 5094, 5208 

2297, 2298, 2321 

5087, 5245, 5259 

5791, 5878, 5961 



crossreference 



page ..162 



label 



address line numbers 



fndrch = 
fndrel = 
fndsec » 
fndwIO = 
£ndwl3 - 
fndw15 = 
fndw20 ° 
fndwch = 
format • 
found o 
fre25 = 
frebl - 
freb2 = 
frebuf = 
frechn = 

freco 

frelch 

fremsg 

frerts 

frets 

freuae 

fslO 

fsl5 

f si set 

gal 

ga3 

gaflgs 

gberr 

gbyte 

gcbyte 

gdl 

gelO 

gel5 

ge20 

ge30 

get 

getO 

getOO 

get! 

get3 

get6 

getact 



$ed6e: 
$eab3: 
$d76c: 
$ed9a: 
$ed91 : 
$eda2: 
$eda4: 
$ed89: 
$e420: 
$4395: 
$eece: 
$ef3a: 
$ef44: 
$ef34: 
$eea4: 

$eeab: 

$f0d3: 

$e20b: 

$da34: 

$da1c: 

$ebb4: 

$ddad: 

$ddb5: 

$dd95: 

$fa9d: 

$fab2: 

$faaO: 

$ee8c: 

$ef95: 

$e662: 

$db31 I 

$f02b 

$f032 

$f03b 

$f03d 

$efa3 

$efc7 

$efad 

$efcc 

$effc 

$f001 

$fa95 



getbl = $edd2: 
getb2 > $edce: 
getbS " $ef27: 
getbul > $ef09: 
getbu2 - $ef16: 
getbu3 - $ef29: 
getbu4 - $efl9: 



915 
3906 
1044 
4366 
4358 
4364 
4365 

847 
2681 

306 
4552 
4636 
4639 
4579 
1389 
5537 
4544 
1350 
2646 
1470 
1467 
1468 
2019 
2012 
2009 
6352 
6363 
6028 
4527 
3242 
3242 
1604 
4763 
3483 
3480 
4774 

939 
4718 
4707 
4715 
4749 
4728 

712 
4211 
4906 
6350 
4402 
4407 
4615 
4606 
4608 
4611 
4614 



1371, 

6733, 

1052, 

4373 

4360 

4373 

4374 

1382, 

2864. 

2163, 

4566 

4642 

4641 

4588, 

2816, 

5579, 

4549 

1687, 

2652, 

1478 

2805, 

4056, 

2022 

2020, 

2747, 

6354 

6369 

6360, 

4535, 

4695 

5448 

1610 

4766, 

4778 

4777, 

4783 

4697, 

4723 

4710 

4727 

4756 

4753 

1513, 

4233, 

5092, 

6463, 

4413 

4410 

4620 

4613 

4612 

4623, 

4627 



2487, 
6870, 
1058 



4112, 

2950 

2170, 



4597, 
3383, 
5605 

4883, 
2654 

2818, 
4070 

2023 
5513 



6435, 
5809, 



4775 
4782 
4705 



1529, 
4314, 
5644, 
7010, 



4626 



3482, 3872, 4336, 4695, 5305, 6087, 6700 
6993 



4356, 5574, 5779 

2191, 2192, 2206, 2313, 2325, 3066, 3080 

4632 

4510, 4542, 4650, 4672, 4885, 4888 

5538 

3717 



6542. 6551, 7062 
5895 



1549, 1566, 1575, 3281, 3874, 4103 

4390, 4491, 4666, 4790, 4870, 4892 

5713, 5983, 6074, 6088, 6145, 6150 
7078 



crossreference 



page ..163 



label address line numbers 



getbuf 
getbyt 

getd3 

getdir 

geterc 

getflg 

gethdr 

getlnk 

getnam 

getpnt 



$ef03: 
$edb8: 

$db20: 
$db1a: 
$fOOc: 
$40: 
$f93e: 
$f90c: 
$eOc9! 
$fOe1: 



getpre = $edbO: 



getr2 

getrA 

getrS 

getr55 

getrch 

getslm 

getwch 

gib20 

glbyte 

gn05 

gn050 

gn051 

gnlO 

gnia 

gnU 

gnl5 

gn20 

gn22 

gn30 

gn35 

gn37 

gn40 

gn45 

gnsub 

goodj 

gpl 

gsspnt 

hdrs 

hed2ts 

hexO 

hex5 

hexdec 

ibop 

ibrd 

ibwt 

id 

id20 

id2030 



$ee64: 
$eea3 : 
$ee94: 
$ee76: 
$ee63: 
$e9e2: 
$ee60: 
$e67b: 
$e65e: 
$e0f4: 
$e0f9: 
$e10b: 
$6118: 
$el25: 
$el39: 
$e147: 
$el68: 
$el70: 
$e180: 
$el90: 
$e195: 
$ela4: 
$e1a8: 
$e0d9: 
$01: 
$f0e4: 
$fa47: 
$1021: 

$fl5d: 
$d9bS: 
$d9cO: 
$d9bl : 
$fa27: 
$fald: 
$fa23: 
$1000: 
$ecel : 
$64: 



4525 
1597 
4448 
1598 
1597 
4712 

41 
954 
6048 
1539 
2351 
6389 
3763 
6587 
4502 
4524 
4526 
4515 
1507 
3763 
4501 
3248 
3190 
2490 
2492 
2500 
2498 
2518 
2524 
2535 
2559 
2566 
2574 
2576 
2584 
2586 
2495 
2475 

95 
4894 
6285 
168 
4277 
4974 
1397 
1398 
1394 
6262 
6245 
6263 

48 
4253 

76 



4603, 5807, 5893 

3379, 4296, 4298, 4400, 4421, 4434, 4438 

5519, 6159, 6161 



6399, 6543, 6563, 6705 

5826, 5924, 6088, 6804, 6950 

6785, 6945 

3805, 4141, 4481, 4761, 4892, 5614, 5619 

6629 

4390, 4400, 4732, 6412, 6480, 6565, 6572 



4537 



3561, 4507, 5785 



3253 



4534, 

3377, 

4775, 

1601 

4755 

4761 

6377, 

5417, 

6779, 

2471 

2488, 

6612, 

3853, 

7000 

4508 

4533, 

4531 

4517 

3529, 

3773 

5870 

3250, 

3240 

2497 

2499 

2507 

2514 

2520 

2526, 

2546 

2562 

2571 

2581 

2579, 

2590 

2591 

2593 

2485 



6287 

6955, 6974, 6978 

1318, 1320, 2071, 2074, 4217, 4219, 4224, 4226 

4284, 4286, 4939, 4941, 4986, 4988, 6094, 6096 

4981 , 5008 

1402 

1404 

1448, 1453 

6265 

6260, 6676, 7080 

649 

4258 

654 



2529, 2531 



2582 



crossreference 



page ..164 



label address line numbers 



id2040 

idle 

idle2 

ieeedi 

leeedo 

image 

Incpnt ' 
incptr i 
index 
initdr ■■ 

Initsu : 
intdrv ■■ 
intpnt ■■ 
inttt ■■ 
Inttab ■■ 
intts ■■ 
ip 



Ipbm 
irsa 
iwsa 
jobnum 



jobrtn 
Jobs 

Jumpc 

140 

141 

142 

145 

146 

150 

Ibused 

IdOl 

ld03 

ld05 

IdlO 

Idcmd 

ledO 

ledl 

ledsO 

ledsl 

limit 

lindx 



$0f 
$d4a7 
$d4b8 
$0200 
$0202 
$4391 

$ee47: 
$ee47: 
$439a: 
$ecff: 

$ece4 ; 
$ecca : 
$f7b4: 
$d3f8: 
$d3f4: 
$d747: 
$0a: 



$d2e8: 
$11: 
$12: 
$a1: 



$439e: 
$1003: 

$dO: 

$ec05: 

$ecOf: 

$ecle: 

$ec33: 

$ec14: 

$ec2e: 

$4349: 

$f52b: 

$f554: 

$f55e: 

$f56c: 

$0b: 

$10: 

$08: 

$da44: 

$da47: 

$437c: 

$15: 



75 

689 

690 

132 

134 

302 

2994 

4479 

2391 

311 

1339 

5195 

2047 

349 

5786 

588 

586 

1036 

186 

545 

3519 

398 

73 

74 

243 

4269 

6260 

315 

165 

4178 

89 

4117 

4127 

4116 

4147 

4131 

4143 

265 

5476 

5488 

5506 

5485 

370 

151 

150 

1487 

1490 

286 

196 

3244 

4380 

4665 

5460 



651 

831, 

700, 

768, 

459, 



840, 
743 
896 
755, 



937, 1390 



926, 943 

1771, 1778, 1779, 1799, 1800, 1801, 1980, 1991 

3010, 4252 

4480 

2272, 2380, 2398, 3064, 3082, 5306, 5707, 5720 

2081, 2687, 2840, 2878, 3327, 4251, 4256, 4274 

5495 

4260, 4275 

353, 4250 

5839, 5872 

596 



5868 
492, 
549, 
3520 
958, 
3161, 
3159, 
1312, 
4814, 
6263, 
2046, 
517, 
4179, 
508, 
4126 
4131 
4125, 
4150 
4134 
4146 
6361, 
5487 
5491, 
5509 
5503, 
5472 
424, 
424, 
1491 
1493 
2255, 
711, 
3562, 
4393, 
4698, 
5464, 



494, 
553, 

1078, 
3164, 
3162, 
2077, 
4816, 
6277, 
4162, 

521, 
4193, 

516 



4139 

6367, 

5505 

5515 

467, 
467, 



2440, 
917, 
3569, 
4449, 
4705, 
5520, 



498, 499, 506, 531, 
554, 557, 558, 559, 



1616, 2615, 

3240, 4822, 

3201, 4110, 

2702, 2721, 

4933, 4981, 
6279 
4204 

721, 2963, 

4617, 5021, 



3724, 5652 

4883, 5044, 

4833, 4886 

3836, 3848, 

5015, 5052, 



2964, 4156, 
5845 



541 , 542 
565, 3516 



5303, 5360 

3875, 4263 
5715, 6089 



4171, 4172 



6544, 6553, 7066 



577, 729, 1492, 2837 
577, 729, 1489, 2837 



2463 

1510, 1555, 1579, 1602, 

3928, 4096, 4136, 4140, 

4512, 4554, 4558, 4571, 

4749, 5038, 5118, 5163, 

5568, 5598, 5610, 5623, 



2473, 2477 

4348, 4368 

4580, 4589 

5301, 5400 

5696, 5793 



crossreference 



page ..165 



label address line numbers 







5811, 


5820, 


5830, 


5839, 


5873, 


5897, 


5905, 


5933, 


5948 






5960, 


5967, 


5976, 


6063, 


6140, 


6215, 


6243, 


6285, 


6350 






6360, 


6382, 


6386, 


6390, 


6394, 


6420, 


6426, 


6471, 


6476 






6591, 


6602, 


6613, 


6620, 


6630, 


6674, 


6719, 


6754, 


6840 






6872, 


6926, 


7013, 


7059, 


7063, 


7079 








lintah 


= $a2 


: 244, 


610, 


624, 


626, 


707, 


3161, 


3162, 


3164, 


3566 






3568, 


4345, 


4361, 


4517, 


4550, 


4556, 


4661, 


5466, 


5562 






5802, 


5804, 


5887, 


5890, 


5997 










llnuse 


= $4348 


: 264, 


628, 


4564, 


4565, 


4679, 


4688, 


4689 






lisner 


= $01 


: 119 


















listen 


= $d5d0 


: 830, 


842, 


910 














lk05 


=> $de7d 


: 2146, 


2158, 


2159 














IklO 


= $de87 


: 2150, 


2171 
















lkl5 


= $de8d 


: 2151, 


2154 
















lk20 


= $de9c 


: 2160, 


2168 
















lk25 


= $deal 


: 2149, 


2162, 


2169 














lk26 


= $deaa 


: 2164, 


2167 
















lk30 


' $deb1 


: 2161, 


2170 
















loadir 


= $f509 


: 5171, 


5472 
















longln 


=■ $32 


: 1197, 


1886 
















lookup 


= $de7a 


: 2145, 


3096, 


3135, 


3266 












loop 


= $d74e 


: 1039, 


1054 
















Irf 


- $80 


: 40, 
6560, 


3191, 
6705, 


3251, 
6736, 


5449, 
6741, 


6379, 
6999 


6410, 


6490, 


6511, 


6522 


IsnlO 


= $d5d8 


: 845, 


846 
















lsnl5 


= $d5e7 


! 849, 


853 
















lsn20 


= $d5ef 


: 858 


















lsn21 


= $d5f5 


861, 


862 
















lsn25 


= $d603 


860, 


871, 


887 














lsn26 


= $d613 


877, 


878 
















lsn28 


= $d628 


885, 


886 
















lsn30 


= $d630 


852, 


857, 


891 














lsn40 


= $d64c 


903, 


904 
















Isnact 


= $0e 


189, 


789, 


793, 


805, 


824, 


1361 








Isnadr 


= $0c 


187, 


584, 


785 














Isnerr 


= $d999 


1362, 


1382 
















Istbuf 


= $4399 


310, 


2340, 


2342, 


2350, 


3060, 


3086 








Istchr 


- $bd: 


246, 


1458, 


1512, 


1580, 


1581, 


1603, 


3475, 


3571, 


3774 






3795, 


3798, 


4401, 


4406, 


4424, 


4450, 


4734, 


4742, 


5797 






5862, 


6414, 


6567, 


6578, 


6621, 


6631 








Istdrv 


= $4394: 


305, 


1685, 


1926, 


1992, 


5194, 


5481, 


5523 






1st job 


=» $434e: 


274. 


7U, 


1516, 


4168, 


4177, 


4192, 


4493, 


4619, 


4668 






4925, 


5022, 


5053, 


5646, 


5842, 


5844, 


5985, 


6148 




Istsec 


- $433d: 


257, 


1006, 


1012, 


1029 












Ixlnt 


= $3f: 


61, 


627 
















m30 


- $e7f8: 


3467, 


3470, 


3482 














mapchk 


= $f671 : 


5662, 


5681 
















ma pout 


- $f655: 


2815, 


5578, 


5644, 


6992 












maxl 


= $d7dd: 


1133, 


1135 
















maxsa 


= $12: 


49, 


244, 


609, 


4337, 


4357, 


6002 








maxsec 


= $d7db: 


1005, 


1132, 


2870, 


3409, 


4970, 


4999 








maxtrk 


= $24: 


52, 


974, 


1045, 


2876, 


4943, 


4997, 


5680 






mdmode 


- $03: 


64, 


5332 

















crossreference 



page ..166 



label 



address line niuabers 



mem 


- $e7af: 


350, 


354, 


3435 












memerr 


= $e7fe: 


3437, 


3449, 


3485 












memrd 


- $e7d4: 


3447, 


3452 














memwrt 


» $e803: 


3445, 


3488, 


3492 












mer5 


» $d8ef: 


1265, 


1271, 


1273 












mer6 


- $d8f7: 


1275, 


1281 














mer65 


- $d8fe: 


1279, 


1302 














mer7 


= $d911: 


1285, 


1292 














iBer70 


= $d910: 


1276, 


1291 














mlstyp 


= $64: 


1207, 


3157, 


5345, 


6709 










molO 


- $f65c: 


3339, 


5647 














mode 


= $439d: 


314, 


5218, 


5234, 


5250, 


5263, 


5331, 


5350, 


5367, 5436 


modlst 


= $d2cb: 


384, 


385, 


5434 












movbl 


= $db0e: 


1588, 


1592 














movbuf 


= $db0c: 


1528, 


1545, 


1565, 


1587 










moverr 


= $d8e4: 


1264, 


1268, 


1299, 


1443 










movlpl 


= $e4dc: 


3043, 


3048 














movlp2 


» $e4eb: 


2990, 


3050 














mrkl 


= $e76a: 


3382, 


3385 














mrk2 


= $e754: 


3375, 


3387 














mrkbam 


= $e74b: 


3337, 


3355, 


3360, 


3372 










msgl 


= $elff: 


2646, 


2649 














msgfre 


^ $e1£a: 


2493, 


2503, 


2644 












msglen 


= $0c: 


2645, 


2654 














mull 00 


=> $eaf5: 


3944, 


3949 














mul200 


= $eafc: 


3945, 


3947 














mul25 


s< $eae6: 


3933 


3936 














mul400 


= $eb12i 


3954, 


3956, 


3958 












mul50 


= $eafl: 


3935 


3940, 


3942 












mulply 


= $eadl: 


3906 


3926 














mxchns 


= $08: 


47 


58, 


60. 


220, 


221, 


223, 


225, 


226, 227 






228 


240, 


241, 


245, 


246, 


277, 


613, 


6366 


mxflls 


= $05: 


106 


238, 


239, 


294, 


295, 


296, 


1851, 


1904 


nlOl 


= $6223: 


2661 


2665 














nioa 


= $e24f: 


2674 


2687 














nllO 


- $e25e: 


2682 


2691, 


2694 












nlll 


= $e261: 


2696 


2698 














nambuf 


- $41 b4: 


321 


1588, 


2537, 


2550, 


2553, 


2556, 


2561, 


2563, 2567 






2573 


2577, 


2583, 


2588, 


2589, 


2600, 


2629, 


2633, 2635 






2636 


2638, 


2647 












nb20 


- $fddl: 


6821 


, 6823 














nb25 


X $fdd9: 


6825 


, 6830 














nb30 


= $£deb: 


6831 


, 6834 














nbcmds 


= $06: 


3600 


, 3625 














nbkh 


- $61: 


224 


, 4328, 


5602, 


5612, 


5626, 


5770, 


5860 




nbkl 


= $59: 


222 


, 4326, 


5600, 


5611, 


5624, 


5627, 


5767, 


5859 


nbslz 


=> $1b: 


109 


. 1591, 


2598 












nbtemp 


= $4377: 


282 


, 1524, 


1541, 


1543, 


1561, 


1563, 


1634, 


1635, 2508 






2517 


. 2522, 


2612, 


2614, 


6916, 


6919 






ncmds 


- $0b: 


347 


, 357, 


1652 












ndl5 


- $eld9: 


2625 


, 2631 














nd20 


. $ele1: 


2622 


, 2627, 


2629 












ndad 


> $40: 


153 

















crossref erence 

page ..167 

label address line numbers 

new = $e217: 351, 355, 2659 

newdir = $elb4: 2510, 2608, 5516 

newmap = $e776: 2714, 3393 

newmpv = $e773: 3328, 3392 

newss = $ff33: 6958, 7007 

nmlO = $e783: 3402, 3427 

nm20 = $e795: 3413, 3418 

nm30 = $e79f: 3420, 3425 

nmi = $ffel: 7098, 7122 

nmiflg = $10f2: 175, 694 

nmodes = $04: 385, 5431 

noblk = $65: 1208, 3746 

nochnl = $70: 1210, 3532, 3868, 4528, 4684, 6702 

nodblk = $04: 98 

nofile = $34: 1199, 1757 

nohdr = $02: 96 

norec - $50: 1200, 5390, 6596, 7001 

nosync = $03: 97 

notlk = $d66b: 916, 920 

notrdy = $00: 117, 4723 

notyet = $ec85: 4157, 4194 

nr = $69: 226, 5822, 5937, 6064. 6387, 6391, 6395, 6422, 6427 

6472, 6477, 6603, 6825, 6833, 6841, 6927 

nrbu20 = $fb64: 6442, 6453, 6457 

nrbu50 = $fb46: 6436, 6446 

nrbu70 = $fb54: 6448, 6451 

nrbuf = $fb25: 6393, 6433, 6484, 6571 

nrfdi = $80: 154 



ns20 - $ff91: 


7059 








ns40 = $ffb6: 


7078, 


7095 






ns50 = $ffc3: 


7076, 


7083 






nssl - $06: 


44, 


45, 


45, 


6333 


nssp = $78: 


46, 


6292 






nstr45 = $f bOl : 


6388, 


6410 






ntypes = $05: 


388, 


2018, 


5437 




nulbuf = $fdca: 


5938, 


6818, 


6937, 


6942 


nullnk = $f919: 


5939, 


6059, 


6943 




numfl > $db42: 


1622, 


1633 







numf2 = $db48: 1624, 1626, 1631 

numfre - $db34: 1615, 2650, 6871 

numsec = $1099: 170, 661, 1136 

nxdbl = $fOb4: 4860, 4861 

nxdrbk = $f083: 4840, 5073 

nxout = $faf2: 6402, 6766 

nxtl = $d6c2: 962, 975, 981, 986, 992 

nxt2 = $d6ec: 971, 985 

nxtbl = $f056: 4796, 4800 

nxtbuf = $£044: 2394, 2819, 3386, 4790 

nxtds = $d6b7: 957, 4847 

nxterr = $d6e7: 970, 982, 993 

nxtrlS = $facd: 6384, 6386 

nxtr20 = $fadf: 6392, 6394 

nxtr30 = $fbld: 6403, 6406, 6425 



crossreference p^g^ ^ ^^g 

label address line numbers 

nxtr35 = $fble: 6419, 6426 

nxtr40 »• $fb06: 6381, 6412 

nxtrSO = $fbl3: 6409, 6419 

nxtrec - $fab9: 6377, 6586 

nxtts = $d6bO: 954, 4463, 5900, 6928, 6935, 7007 

ob05 » $e845: 3532, 3539, 3550, 3553 

oblO = $e84a: 3527, 3535 

obl5 = $e85d: 3544, 3547 

ob30 = $e88e: 3530, 3565 

ok = $ec7d: 4159, 4163, 4189 

okerr = $d9d2: 1425, 1641 

onedrv = $ddlOi 1917, 2659, 5213 

op021 = $f2b5: 5146, 5148, 5167 

op04 = $f2cl: 5170, 5176 

op041 = $f2d6: 5168, 5186 

op04l5 = $f2dd: 5150, 5190 

op042 - $£2ec: 5187, 5196 

op049 = $f2f5: 5197, 5200 

oplO = $f2fd: 5201, 5205 

oplOO - $f405: 5327, 5331 

opIlO = $f417! 5333, 5336, 5340 

opll5 = $f420: 5297, 5299, 5345, 5354 

opl20 = $f425: 5344, 5348 

opl25 = $f44b: 5352, 5366 

opl30 = $f47e: 5387, 5389, 5393 

op20 » $f30t: 5199, 5206, 5208 

op40 = $£336: 5222, 5226, 5230, 5261, 5264 

op45 - $£34a: 5233, 5239 

op50 = $£360: 5236, 5240, 5247, 5250 

op60 = $£36a: 5228, 5256 

op75 = $£381 z 5252, 5265 

op80 - $£395: 5271, 5275 

op81 = $£39f: 5268, 5277, 5281 

op8l5 - $£3ae: 5285, 5289 

op82 - $f3b3: 5283, 5293 

op90 - $£3f9: 5253, 5325 

open = $£279: 1647, 5140 

op£l =. $f4bc: 5416, 5424 

opfin = $£4a7: 5323, 5369, 5414 

opirlO = $e65a: 3233, 3235 

opir£l - $e61e: 3152, 3184, 3208 

opnblk » $e837: 3525, 5188 

opnird - $£06c: 2341, 2379, 2806, 3217, 3374, 4822 

opnirw - $f07c: 3180, 4833 

opnrch > $£747: 4826, 5161, 5181, 5399, 5784 

opntyp = $£072: 4825 

opnwch - $£7e6: 4835, 5300, 5412, 5868 

opread - $f45b: 3230, 5366, 5376 

optsch - $delO: 2085, 2145, 2749, 3050, 5214, 5515 

opwrt - $£49b: 5273, 5278, 5409 

orlO - $£764: 5795, 5798 

or20 - $£780: 5808, 5811 

or30 - $f7a8: 5800, 5829 



crossreference 



page ..169 



label address line numbers 



orgsa 


= $17: 


198, 


797, 


810, 


853, 


1355, 


1642, 


4122 






orow 


= $f797: 


5820, 


5942 
















oslO 


= $de1b: 


2090, 


2102, 


2104 














osl5 


= $de2e: 


2098, 


2101 
















os30 


= $de35: 


2096, 


2105 
















os35 


= $de46: 


2U5, 


2133 
















os40 


= $de67: 


2113, 


2132 
















outran = $50: 


43 


















ovrflo = $20: 


42, 


6377, 


6399, 


6479, 


6490, 


6500, 


6529, 


6705 




owlO 


= $f808: 


5881, 


5886 
















ow20 


- $f821: 


5894, 


5897 
















oxOOOC 


= $de64: 


2118, 


2121, 


2129 














P2 


- $fd6c: 


6758, 


6761 
















p20 


= $fda9: 


6777, 


6787, 


6791 














p30 


=. $fd74: 


6763, 


6766 
















p80 


- $fdaa: 


6781, 


6784, 


6793 














pad2 


= $0280: 


139, 


464, 


752, 


753, 


757, 


758, 


759, 


764, 


765 






772, 


773, 


820, 


827, 


828, 


834, 


835, 


843, 


844 






845, 


861, 


864, 


865, 


872, 


873, 


875, 


876, 


877 






880, 


881, 


883, 


884, 


885, 


892, 


893, 


901, 


902 






903, 


906, 


907, 


929, 


930, 


935, 


936, 


945, 


946 






1372, 


1374, 


1384, 


1386 












paddl 


= $0201: 


133 


















padd2 


= $0281: 


148, 


466 
















parse 


» $dc69: 


1712, 


1725, 


1766, 


1788, 


1828, 


3016, 


3590, 


3640, 


5210 


parsxq 


- $db5b: 


695, 


1641 
















patflg 


- $4390: 


301, 
2223, 


1775, 
2270 


1781, 


1792, 


1839, 


1844, 


1849, 


1856, 


1902 


pbd2 


= $0282: 


149, 


433, 


440, 


462, 


576, 


578, 


579, 


728, 


742 






922, 


931, 


940, 


947, 


1347, 


1349, 


1484, 


1493, 


1496 






1498, 


2838, 


2839 














pbddl 


= $0203: 


135, 


460 
















pbdd2 


= $0283: 


155, 


468 
















pbyte 


= $ebef: 


4112 


















pcmd 


- $08: 


364, 


366, 


1662 














pdlO 


= $d30e: 


435, 


439 
















pdll 


= $d31a: 


443, 


447 
















pd20 


= $d30f: 


436, 


437 
















pd21 


=. $d31b: 


444, 


445 
















pe20 


= $d307: 


423, 


452 
















pe30 


= $d308: 


424, 


449 
















pe40 


= $d3l9: 


441, 


451 
















perr 


= $d304: 


421, 


507, 


657 














perr2 


= $d37d: 


507. 


525, 


555, 


560 












pezro 


= $d301: 


419, 


484, 


486 














pibyte 


= $ebeb: 


3189, 


3196, 


4110 














ponbmp 


= $d492: 


676 


















posbuf 


= $fd7a: 


6751, 


6772, 


6861 














posltn 


= $fd58: 


6740, 


6751, 


6997 














prlO 


- $dc6c: 


1829, 


1841, 


1852 














pr20 


= $dc81: 


1836, 


1839 
















pr25 


=■ $dc84: 


1838, 


1840 
















pr28 


= $dc9b: 


1846, 


1850 

















crossreference 



page . . 1 70 



label 



address line numbers 



pr30 

pr35 

pr40 

prgsec 

prgtrk 

prgtyp 

prscln 

prseq 

psOS 

pslO 

ps20 

ps30 

pulO 

pu20 

pu30 

pupsl 

put 

putbl 

putbyt 



$dcaO: 
$dca2: 
$dcb4: 
$4374: 
$11: 
$02: 
$dbe6: 
$e4a8: 
$db6b: 
$db75: 
$db85: 
$db8f: 
$d348: 
$d34e: 
$d351: 
$e571 : 
$ebfd: 
$ecc2: 
$ecb6: 



putss = $f895: 
rO = $19: 



rl 

r2 

r20 

r3 

r30 

r4 

r40 

r50 

r60 

ralO 

ra30 

ra40 

raiotst 

rcont 

rd05 

rdl 

rdlO 

rdl5 

rd20 

rd25 

rd3 

rd30 

rd4 

rd40 

rdab 



= $la: 

= $lb: 
= $fcfc: 
" $lc: 

- $£dOb: 
" $1d: 
= $fd36: 
=■ $fd48: 

- $fd55: 
" $d3a8: 
= $d3b8: 

- $d3ba: 
> $d3a6: 

- $d383: 

- $fc44: 
" $edeb: 

- $fc08: 

- $fcle: 

- $fc21: 
» $fc23; 

- $eel2: 

- $fc33: 
» $eel3: 

- $fc39: 

- $£959: 



1830 

1834 

1858 

279 

192 

70 

1722 

2834 

1643 

1653 

1655 

1663 

472 

476 

479 

3051 

908 

4234 

1518 

1542 

3814 

4860 

5911 

6963 

206 

5727 

5757 

207 

6897 

208 

6701 

209 

6708 

210 

6723 

6735 

6743 

539 

549 

550 

538 

511 

6562 

4425 

6563 

6572 

6570 

6574 

4422 

6579 

4436 

5825 

3275 



1853 
1854 
1861 
5159, 
5149, 
3155, 
1755, 
2979, 
1646, 
1657 
1661 
1665 
475 
488 
481 
3071, 
4122 
4239, 
1520, 
1544, 
4135, 
4862, 
5913, 
6965 
2751, 
5729, 
5761, 
6604, 
7039, 
6611, 
6705 
6773, 
6712 
3971, 
6726, 
6740 
6746 
544, 
564 
562 



5423 

5421 

5156, 5156, 5190, 5190, 5237 

2977, 5196, 5505 

3015 

1649 



3119 

5950 

1522, 1523, 1525, 1527, 1535, 1537, 1538 

1547, 1562, 1564, 1572, 1573, 1574, 1589 

4145, 4232, 4458, 4467, 4469, 4853, 4855 

4864, 5085, 5088, 5091, 5618, 5634, 5636 

5915, 5917, 5919, 5921, 5926, 5928, 5947 

2793, 2796, 3733, 3892, 5719, 5721, 5722 

5731, 5735, 5738, 5747, 5749, 5752, 5754 

5764, 5768, 5771, 6865, 6903, 6961, 6971 

6605, 6609. 6614, 6626, 6638, 6863, 6886 

7086 

6644, 6646, 6867, 6915, 6930, 7043, 7089 

6794, 6797, 6806, 6811, 7033, 7085 

3974, 6775, 7037, 7083, 7084, 7093 

6728, 6732 



547 



515 
6591, 6738, 6744 
4431 

6767 

6573 

6589 

4446 

6582 

4448 

6506, 6568, 6586 

6110, 6443, 6449, 6455, 6789 



crossreference 

label address line numbers 



page ..171 



rdbuf = $ed46: 4294, 4306, 4309, 4443 

rdbyt = $edd7: 2809, 2811, 4421, 4748, 4798. 5829 

rdin = $f967: 6124 

rdlnk » $f997: 5452, 6157, 6434, 6451 

rdmode = $00: 65 

rdrel = $fc01: 4708, 6560 

rds5 = $f977: 6133, 6139 

rdss » $f975: 5818, 6138 

rdylst - $01: 123, 124, 125, 629, 5882 

rdytlk = $88: 122, 124, 631, 1460, 1554, 4782, 5832 

'■^"1. " . ^^'- ^^' 2909, 4309, 4805, 6110, 6124, 6138, 6261 

readl5 = $e3ff: 2921, 2924 

reads = $e3dc: 2885, 2908 

readsl = $e3e6: 2912, 2917 

reads3 = $e3f5: 2919, 2923 

reads8 = $e3f3: 2915, 2918 

rec - $434b: 267, 1895, 2302, 2306, 3229, 5114, 5217, 5258, 5384 

5385, 5388, 5805, 5891, 5916 

reel = $ec5b: 4172, 4173 

rec2 = $ec66: 4177, 4184 

rec3 = $ec6c: 4179, 4180 

rec4 = $ec78: 4165, 4185 

rec5 = $ec7b: 4182, 4187 

rech = $61: 225, 3931, 6385, 6718 

reel = $59: 223, 3929, 6383, 6716 

record = $feea: 350, 354, 6697 

reeov = $ec4a: 4164 

recovf - $51: 1201, 6503, 6729 

reeptr = $82: 234, 3950, 6732, 6757, 6869 

rell = $eee0: 4574, 4580 

rellO = $eee8: 4561, 4564 

rell 5 = $eee2: 4560, 4563 

rel2 - $eefl: 4583, 4589 

rel3 = $ef02: 4592, 4598 

relbuf = $eecf: 4527, 4557, 4571 

relp06 =. $fb7f: 6470, 6475 

relp07 = $fb87: 6473, 6479 

relplO = $fb8c: 6478, 6482 

relp20 = $fb93: 6483, 6485 

relptr = $85: 237, 3909, 3911, 3912, 6752, 6762, 6877 

relput = $fb65: 6462, 6495, 6534 

reltyp = $04: 67, 4384, 5082, 5105, 5227, 5298, 5353, 5572, 5799, 

rename = $e67c: 351, 355, 3258 

result - $le: 211, 3913, 3952, 3953, 3955, 3957, 4013, 4015, 4017 

4025, 4026, 4027, 4046, 4048 

revent = $435e: 275, 644, 4164, 4174, 5016 

rfdo = $04: 142, 463, 756, 763, 826, 842, 871, 882, 891, 

rlindx = $4376: 281 

rmlO = $d362: 491, 509 

rnlO = $e68b: 3263, 3265 

rndeoi = $81: 125, 4744, 6582, 6594 

rndget = $efd7: 4721, 4732 

rndrdy = $89: 124, 3572, 3775, 4719, 6575, 6720 



5880 



crossreference page ^^^72 

label address line numbers 



rngetl = $efe5: 3783, 4735, 4738 

rnget2 - $efe7: 3820, 3854, 4137, 4739 

rnget3 - $eff8: 4743, 4746 

rom » idOOO: 38, 326 



roml - $d2f8: 405 

rs - $71: 227, 3942, 5806, 5892, 5936, 6610, 6727, 6755, 6845, 6873 

rtlO - $d36e: 498, 503 

rt20 - $d370: 499, 501 

sa » $16 




sa05 = $dd6c: lyo^, lyyu 

salO = $dd7f: 1987, 1991 

sa20 « $dd85: 1984, 1993 

scl5 = $e2d3: 2758, 2795 

3cl7 = $e2f3: 2772, 2782 

sc20 = $e30b: 2785, 2793 

sc25 - $e30d: 2759, 2767, 2794 

sc30 = $e312: 2753, 2796 

scall = $fa4e: 6292, 6295 

scflg - $f89d: 5955 

schtbl - $de6b: 2107, 2137 

scrl = $f8fc: 6029, 6032 

scrend = $dba9: 1680, 2800 

scrtch - $e2cl: 351, 355, 2747 

scrub = $f8fl: 5584, 6028, 6778, 7009 

sd20 = $dd48: 1950, 1967 

3d22 = $dd49: 1951, 1964, 1966 

sd24 - $dd4b: 1952, 1975 

sd40 = $dd4e: 1959 

sd50 = $dd5d: 1968 

sdirty = $fbeb: 6043, 6462, 6542 

selO = $fcbb: 6664, 6668 

se20 = $fcbf: 6662, 6667 

se30 » $fcd2: 6672, 6677 

search = $e043: 2160, 2201, 2357, 2364, 2370, 2386, 5071 

seclnc = $4344: 260, 643, 1002, 4843, 4846, 4849 

secss = $434d! 269, 5111, 5381, 5815, 5904 

sector - $14: 195, 979, 990, 1000, 1003, 1008, 1011, 1013, 1015 

1018, 1027, 1028, 1063, 1067, 1099, 1321, 1429, 1452 

1680, 1703, 2275, 2339, 2359, 2378, 2400, 2708, 2719 

2776, 2791, 2812, 2871, 2872, 2887, 2898, 3216, 3274 

3334, 3354, 3357, 3380, 3729, 3731, 3736, 3887, 4074 

4081, 4218, 4267, 4299, 4439, 4468, 4854, 4989, 5000 

5040, 5063, 5065, 5074, 5160, 5180, 5316, 5398, 5422 

5453, 5651, 5703, 5742, 5755, 5796, 5816, 5903, 5920 

5927, 6041, 6053, 6097, 6162, 6276, 6798, 6812, 6948 

6951, 6967, 7042, 7074 

sectrk = $d2ea: 400, 404, 660 

seek - $bO: 87, 4271 



crossreference 



page ..173 



label address line numbers 



aeqget 


= $eff9: 


4731, 


4748, 


4754 














seqtyp 


= $01: 


69, 


5183, 


5183, 


5248 












setOO 


= $f92b: 


6037, 


6048, 


6059, 


6074, 


6637, 


6818 








setany 


= $dd64: 


1717, 


1979 
















setbmp 


= $d789: 


1038, 


1077, 


1467, 


2668, 


2841, 


2857, 


3372, 


3392 




setdir 


- $fOe4: 


4893 


















setdrn 


>• $ee54: 


4441, 


4462, 


4491, 


6433, 


6859 










setdrv 


- $dd3a: 


1930, 


1943 
















seterr 


- $d48d: 


670 


















setfle 


. $dd5d: 


1948, 


1972 
















setflg 


= $f89f: 


3252, 


5960, 


6411, 


6564, 


6737 










seth 


- $ec97: 


2078, 


2897, 


2960, 


4212, 


4268, 


4815, 


5817, 


5907, 


6278 


sethdr 


= $ec94: 


4211, 


4293, 


4305, 


4442, 


4472, 


5871, 


6144, 


6934, 


6941 


setjob 


= $fll6: 


2913, 


2933, 


4932, 


5030 












setlOl 


=■ $fc63: 


6607, 


6610 
















setlOS 


= $fc81: 


6619, 


6624 
















setllO 


- $fc88: 


6615, 


6616, 


6627 














setl40 


= $fc90: 


6628, 


6630 
















setlds 


- $da35: 


1483, 
4696, 


1995, 
5158 


2129, 


2157, 


2183, 


2667, 


3893, 


4113, 


4255 


setljb 


- $f10e: 


4316, 


4925, 


6152 














setlnk 


- $f8fd: 


6037, 


6929, 


6936 














setlst 


= $fc53: 


6428, 


6602 
















setnme 


= $dd4e! 


1946, 


1960 
















setpnt 


- $fOcl: 


1509, 


2381, 


2808, 


3222, 


3236, 


3280, 


3376, 


3772, 


3812 






4433, 


4465, 


4474, 


4779, 


4828, 


4851, 


4859, 


4869, 


5079 






5307, 


5459, 


5633, 


5824, 


5932, 


6158, 


6396, 


6440, 


6753 






7026, 


7053, 


7069, 


7082 












setr3 


= $e3cc: 


2896, 


2901 
















setr6 


= $e3db: 


2899, 


2903 
















setrh 


= $e3cl: 


2884, 


2891 
















setslO 


= $d474: 


653 


















sets20 


= $d47a: 


656 


















sets30 


= $d47f: 


652, 


655, 


659 














8ets40 


= $d481: 


660, 


665 
















setsec 


= $d46b: 


649 


















setssp 


= $f9eb: 


5909, 


5923, 


6225, 


6253, 


6687, 


6889, 


6960 






slmprs 


= $dbd2: 


1709, 


3326, 


4250, 


5176 












sjlO 


= $f981: 


6105, 


6112, 


6144 














sj20 


- $f98d: 


6119, 


6126, 


6149 














sj30 


= $f994: 


6143, 


6152 
















ajbl 


- $fl88: 


4950, 


4973, 


5015 














sjb2 


- $fl40: 


4954, 


4957 
















sjb3 


- $fU3: 


4956, 


4958 
















sjb4 


= $fl4a: 


4958, 


4969 
















splO 


= $dbe3: 


1713, 


1717 
















srIO 


= $dffl: 


2342, 


2395 
















srl5 


= $dff7: 


2343, 


2346 
















sr20 


■> $6004: 


2351, 


2392 
















sr30 


» $e028: 


2355, 


2367 
















sr40 


= $e055: 


2389, 


2394 
















srSO 


" $e05b: 


2369, 


2397 
















srchst 


= $dfda: 


2148, 


2189, 


2332, 


3331, 


5058 











crossreference 



page ..174 



label 



address line numbers 



srre 


= $e031 


: 2177, 


2375, 


3361 














S3 


= $7C 


»: 228, 


616, 


4590, 


4595, 


5812, 


5898, 


5906. 


5949, 


6141 






6216, 


6244, 


6286, 


6675, 


7014, 


7060, 


7064 






sscalc 


- $fa52 


: 5597, 


6294, 


6909 














ssdir 


- $f9de 


: 6206, 


6214, 


6226, 


6981, 


7021 










ssend 


= $fcae 


: 5586, 


6248, 


6657, 


6860 












sslnd 


» $84 


: 236, 
6884, 


3919, 
6895, 


5593, 
6975 


6252, 


6323, 


6685, 


6862, 


6879. 


6880 


ssloff 


» $10 


: A5, 


5595, 


5912, 


5922, 


6661, 


6883, 


6959, 


7018, 


7049 


ssnum 


= $83 


: 235, 
6882, 


3914, 
6890, 


5587, 
6902, 


6321, 
6972 


6332, 


6658, 


6671, 


6673, 


6864 


ssplO 


= $faOd 


: 6241, 


6248 
















ssp20 


= $fal4 


: 6242, 


6247, 


6252 














sspos 


= $f9fa 


: 6240, 


6734. 


6995 














ssset 


= $f9d4 


: 6205, 


6320, 


6657 














sstest 


= $fa68 


: 6240, 


6246, 


6320 














stlO 


= $fa79 


: 6325, 


6329 
















st20 


= $fa7d 


: 6322, 


6332 
















st30 


= $fa8d 


: 6334, 


6341 
















st40 


- $fa91 


: 6340, 


6344 
















stdir 


o $da54 


: 1504, 


5518 
















strl 


= $ed3a 


: 4301, 


4304 
















strdbl 


- $ed22 


: 4293, 


5792, 


6799 














strslz 


= $433a 


: 254. 


2413, 


2448, 


2456, 


2459 










strtit 


- $ed4c 


! 4310, 


4313 
















struct 


= $d2bb 


: 366, 


370, 


1803 














to 


= $04 


: 201, 


3403, 


3414, 


5670, 


6173, 


6182, 


6195, 


6197 




tOvl 


= $ddc5 


: 2031, 


2033, 


2035 














tl 


- $05 


: 202, 


705, 


736, 


1104, 


1617, 


1669, 


3404, 


3415, 


3441 






3478, 


3542, 


3545, 


3551, 


3557, 


3615, 


3667, 


3677, 


3680 






3838, 


4604, 


4609, 


4614, 


5591, 


5599, 


5673, 


6011, 


6015 






6176, 


6193, 


6301, 


6302, 


6369, 


6371, 


6906, 


6912. 


6920 


t2 


= $06 


: 203, 


1105, 


2895, 


2896, 


2900. 


2902, 


2911, 


2918, 


2932 






2938, 


3405, 


3416, 


3678, 


4905, 


4911, 


5592, 


5601, 


5676 






5733, 


5751, 


5996, 


6000, 


6006, 


6174, 


6183, 


6304, 


6907, 6910 


t3 


= $07 


: 204, 


702, 


706, 


718, 


1091, 


1123, 


1297, 


1300, 


3668 






3698, 


3702, 


4909, 


5596, 


5667, 


6178, 


6296, 


6901 




t4 


=. $08 


: 205, 


5588, 


5589. 


5655, 


5666, 


5669, 


5672, 


5675, 


6299, 6904 


tabjmp 


= $d2f8 


. 411, 


512 
















tagcod 


= $dbef 


! 1664, 


1755 
















talk 


= $d660 


839, 


915 
















talkl 


= $d665 


917, 


949 
















talker 


- $80 


118 


















tc25 


>• $dbf4 


1757, 


1764 
















tc30 


= $dbf9 


1756, 


1760, 


2992 














tc35 


- $dc01 


1765, 


5512 
















tc40 


- $dc0b 


1768, 


1770 
















tc50 


- $dc29 


1776, 


1782 
















tc60 


- $dc46 


1793, 


1795 
















tc70 


- $dc4d 


1796, 


1798 
















tc75 


- $dc55 


1783, 


1801 
















tc80 


- $dc61 


1804, 


1807 
















temp 


~ $04 


185, 


201, 


202, 


203, 


204, 


205, 


421, 


491, 


518 



crossreference 



page ..175 



label address line numbers 



tempsa 


= $433b: 


tlerr 


- $d9a6: 


tlklO 


= $d66c! 


tlk20 


= $d682: 


tlk30 


= $d694: 


tlk35 


= $d697: 


tlk40 


= $d6a9: 


tlkact 


= $0£: 


tlkadr 


= $0d: 


tlkerr 


= $d98c: 


tnlO 


" $e07c: 


tn20 


=• $e082: 


togdrv 


= $dd8c: 


tpllst 


= $d2d9: 


tp21st 


= $d2de: 


tplst 


- $d2cf: 


trio 


= $e092: 


tr20 


= $eOaO: 


track 


- $13: 



trcmbf = 
trfO = 
trfnme = 
trknum - 
trks = 
trkss = 
trktbl = 
trname = 
tschk = 
tserl = 
tserr = 
tstOvl = 
tstc20 = 
tstc30 = 
tstc40 = 
tstchn = 
tstfil = 



$e083: 
$e566: 
$e561 : 
$d7e7: 
$1012: 
$434c: 
$d2c7: 
$e069: 
$fl6e: 
$fl58: 
$fl55: 
$ddbb: 
$f8cl : 
$f8c9: 
$f8dl: 
$f8bf: 
$d4df! 



532, 
1095, 
2094, 
2294, 
3474, 
3666, 
3967, 
4509, 
255, 
1375, 
919, 
931, 
932, 
940, 
947, 
190, 
188, 
1371 
2418, 
2415, 
2000, 
389, 
390, 
386, 
2435, 
2438, 
194, 
1037, 
1679, 
2810, 
3359, 
4265, 
5152, 
5683, 
6038, 
6807, 
2410, 
3109, 
3092, 
1133, 
166 
268, 
383 
2408, 
3891, 
4975, 
4942, 
1983, 
5996, 
6000, 
5999, 
2758, 
720 



656, 
1103, 
2099, 
2610, 
3476, 
3679, 
3986, 
4523, 
5141, 
1387 
922, 
933 
939 
941 
948 
794, 
582, 

2421 
2416, 
2156, 
2552 
2549 
5440 
2441 
2442 
962, 
1039, 
1702, 
2813, 
3378, 
4297, 
5178, 
5712, 
6050, 
6946, 
2427 
3113 
3107 
1142 



5108, 5378, 

2724, 3285, 

4995 

4996, 4998, 

4944, 4972, 

2030, 3022, 

6003 

6016, 6019 

6006 

5995 



704, 


717, 


1474, 


1620, 


2100, 


2103, 


3039, 


3047, 


3489, 


3541, 


3682, 


3692, 


3995, 


4011, 


4532, 


4842, 


5145, 


5169, 



725, 
1623, 
2274, 
3420, 
3544, 
3835, 
4061, 
4869, 
5230 



731, 
1667, 
2276, 
3439, 
3548, 
3842, 
4073, 
4875, 



956, 


980, 


991 


1670, 


2086, 


2091 


2283, 


2289, 


2290 


3450, 


3452, 


3473 


3554, 


3617, 


3618 


3943. 


3944, 


3948 


4079, 


4480, 


4483 



923 



800, 
802 



2422 
2182, 



968, 
1047, 
2337, 
2863, 
3381, 
4300, 
5313, 
5732, 
6095, 
6953, 



804. 836, 1363 



2502, 2505, 2848, 4254, 4257 



972, 
1053, 
2376. 
2869. 
3737, 
4437, 
5396, 
5740, 
6160, 
6969, 



5813, 

5097 

5001, 

4974 

3028, 



973, 
1061, 
2680, 
2874, 
3739, 
4466, 
5418, 
5794, 
6273, 
7038, 



5902 

5002 
5490 



977, 
1086, 
2712, 
2875, 
3745, 
4852, 
5657, 
5814, 
6452. 
7071 



985, 
1319. 
2773. 
3213, 
3889, 
4987, 
5662, 
5901, 
6780, 



988, 
1428, 
2789, 
3336, 
4070, 
4995, 
5678, 
5918, 
6786, 



1004 
1447 
2797 
3351 
4216 
5042 
5679 
5925 
6795 



crossreference 



page ..176 



label 



address line numbers 



tstflg 


s 


$f8ae: 


3192 


, 5450, 


tstjob 


3 


$ec37: 


4156 


4200 


tstwrt 


a 


$f8b3: 


5983 


6441, 


type 


a 


$c5: 


247 
5219 
5787 


1896, 
5235, 
5874 


typfil 


m 


$eda6: 


1387 
4716 


3153, 
4729, 


typflg 


= 


$439c: 


313 


1897, 


typist 


= 


$d2d4: 


387 


388, 


typmsk 


a 


$0e: 


72 


3225, 


ublkrd 


s 


$ea0S: 


3793 


7109 


ublkwt 


a 


$ea3d: 


3825 


7110 


ublock 


s 


$ffea: 


3501 


3503, 


unlsn 


a 


$3f: 


116, 


787 


uslO 


3 


$e81f: 


3500 


3507 


usedts 


a 


$eb9f! 


1032 


1072, 


user 


= 


$e80f: 


350 


354, 


userts 


a 


$ebb3: 


4057 


4065 


usrexc 


a 


$e825: 


3507 


3510 


usrlnt 


a 


$e816: 


637 


3501 


usrjmp 


a 


$00: 


183 


3502, 


usrtyp 


a 


$03: 


71 




val 


a 


$01: 


359 




valdat 


a 


$e6f3: 


3326 




vdlO 


a 


$e706: 


3333 


3362 


vdl5 


a 


$e719: 


3342 


3365 


vdl7 


a 


$e731: 


3350 


3356 


vd20 


a 


$e73a: 


3361 


3367 


vd25 


a 


$e73f: 


3332 


3363 


verdir 


a 


$e6f3: 


349 


353, 


vererr 


a 


$07: 


50 




vernum 


a 


$t09f: 


171 


2690, 


vnerr 


a 


$fl80: 


2692 


2846, 


vnml 


a 


$10f0: 


174 


639, 


watjob 


' 


$ec87: 


2829 
4857 
6991 


2919, 
5031, 
7055, 


wllndx 




$4375: 


280 


5302, 


wrlO 




$fb9b: 


6494 


6524 


wr20 




$fba0: 


6496 




wr30 




$fba5: 


6500 


6514 


w40 




$fbbl: 


6497 


6502, 


wr50 




$fbbf: 


6493 


6511 


wr51 




$fbc7: 


6508 


6515 


wr60 




$fbc8: 


6512 


6517 


wrltO 




$e409: 


2933 


2937 


wrltlO 




$e415: 


2939 


2943 


wrlt20 




$e41f: 


2941 


, 2944 


wrlt5 




$e413i 


2935 


, 2938 


write 




$90: 


85 
6131 


2929, 
, 6264 


writes 


m 


$e400: 


2886 


, 2929 



5976, 6380, 6492, 6501, 6530, 6561, 6742 

6447 

3227, 3296, 4825, 5047, 5081, 5104, 5130 

5238, 5239, 5244, 5249, 5296, 5343, 5442 

3194, 3232, 3249, 4126, 4323, 4380, 4706 

5569, 5725, 6707 

2025, 2209, 2213, 5191 

2019, 2555 

5242, 5294 



7109 



2718, 2720, 3373, 3385, 3751, 4056 
3498 



3504, 3515, 3518 



3325 

2716, 2739, 2844, 2859, 4967 

4968, 5008 

641, 7098 

2939, 3276, 3287, 4105, 4200, 4201, 4295 

5638, 5819, 5930, 5941, 6031, 6444, 6450 
7092 

5319, 5697, 5765 



6505 



4312, 4811, 4949, 5690, 5774, 6103, 6117 



crossreference 

page ..177 

label address line numbers 

wrprot = $08: 101 

wrtO = $ee24: 4459, 4462, 5457 

wrtab - $f952: 6103, 7054 

wrtbuf - $ed4a: 4312, 4470, 4856, 5637 

wrtbyt - $eele: 4129, 4458 

wrtcl » $ed6b: 4325, 4327, 4329 

"tre^irlS; 4?32: S' '''°' ''''' ''''' ""''' '"''' ''''• '^' 

wrtss - $f96e: 5929, 6131, 6990 

vftmode = $01: 66, 5251, 5262 

wverer = $07: 100 

wverfy » $aO: 86 

X0015 = $e4af: 3018, 3023, 3029, 3031 

X0020 = $e4b4: 3017, 3021 

zerres = $eb7e: 3926, 3977, 4024 



coNTErns 

DIac Controller Section 



Equates, labels & variables for Disk Controller 2 

Power-on reset 5 

Job queue scanning 6 

Execute, optimize Job 9 

Compare 13 

Terminate DC routines, abort 16 

Read, write routines 17 

Format routine 21 

Disk Controller, Format crossreference 31 



Disk Controller Equates and Labels 



page 2 



line addr object 



source code 



00004 


0000 


00005 


0000 


00006 


0000 


00007 


0000 


00008 


0000 


00009 


0000 


00010 


0000 


00011 


0000 


00012 


0000 


00013 


0000 


OOOU 


0000 


00015 


0000 


00016 


0000 


00017 


0000 


00018 


0000 


00019 


0000 


00020 


0000 


00021 


0000 


00022 


0000 


00023 


0000 


00024 


0000 


00025 


0000 


00026 


0000 


00027 


0000 


00028 


0000 


00029 


0000 


00030 


0000 


00031 


0000 


00032 


0000 


00033 


0000 


00034 


0000 


00035 


0000 


00036 


0000 


00037 


0000 


00038 


0000 


00039 


0000 


00040 


0000 


00041 


0000 


00042 


0000 


00043 


0000 


00044 


0001 


00045 


0003 


00046 


0005 


00047 


0007 


00048 


0008 


00049 


0009 


00050 


000a 


00051 


000b 


00052 


000c 


00053 


OOOd 



=> Equates for Disk Controller <= 

good J = 1 
nohdr = 2 
nosync = 3 
nodblk = 4 
badbch = 5 
wverer = 7 
wrprot = 8 
badhch = 9 
badld - 11 
badfmt = 12 



bid 

hbid 

tries 

offbyt 

bufpnt 

maxtrk 

stpcnt 

bmpfl 

readj 

writej 

verfyj 

seekj 

bumpj 

jurapj 

readc 
jurapc 
exec 



7 

8 

10 

15 

$21 

36 

$8c 

$cl 

$fc 
$10 
$20 
$30 
$40 
$50 

$80 
$dO 
$eO 



==> external labels < === 





*-0 


irqcnt 


*=.*+1 


mtrtm 


*^+2 


drvst 


*=.*+2 


steps 


*=*+2 


cow 


♦.*+1 


work 


*=*+1 


ctrack 


*=*+1 


nxtrk 


*=*+1 


csectr 


*=*+1 


csect 


*=*+1 


stab 


*=*+5 



job completed successfully 
header block not found 
no sync character 
data block not found 
data block checksum error 
verify error after write 
write protect on 
header block checksum error 
ID mismatch error 
format error 

data block ID 

header ID byte 

maximum allowable errors 

OFF byte 

pointer into header buffer 

highest track number plus 1 

steps to move to track 

flag to indicate head is stepping 

read command for PCR 
write command for PCR 
do wverfy 
do seek 
do bump 
do jumpc 

read a sector 

jump to machine code in buffer 
execute code in buffer when speed & 
head ready 



irq counter lo 

motor timing drive 0/1 

drive status (0/1) 

steps to move to desired track 

(0-127 

buffer for irq/motor timing bits 

temporary workspace 

current track 

next track to move head to 

highest sector to read 

last sector read 

current block header (1D1, ID2, 

track, sector, parity) 



Disk Controller Equates and Labels 



page 



line addr object source code 



00054 


0012 


00055 


0013 


00056 


0014 


00057 


0015 


00058 


0016 


00059 


0018 


00060 


001a 


00061 


001 e 


00062 


001 f 


00063 


001 f 


00064 


0020 


00055 


0020 


00066 


0020 


00067 


0040 


00068 


0040 


00069 


0040 


00070 


0040 


00071 


0040 


00072 


0040 


00073 


0040 


00074 


0040 


00075 


0040 


00076 


0040 


00077 


0040 


00078 


0040 


00079 


0040 


00080 


0040 


00081 


0080 


00082 


0080 


00083 


0080 


00084 


0080 


00085 


0080 


00086 


0080 


00087 


0080 


00088 


0080 


00089 


0080 



drive ♦=*+1 

track *=*+1 

nexts *=*+l 

sectr *=*+l 

bufpt ♦=♦+2 
hdrpt ♦=*+2 

ftnum *>.*+4 
job *=*+! 
errcnt *=* 
Jobnura *=*+1 



♦-$40 



via 


*=♦ 


prb 


- 


pra 


« 1 


ddrb 


= 2 


tUcl 


= 4 


tlch 


= 5 


acr 


= 11 


per 


= 12 


ifr 


= 13 


ler 


= 14 



rriot 
orega 
drega 
oregb 
dregb 
timer 



*=$80 

*=♦ 
= 
= 1 
= 2 
= 3 
= 15 



current drive 

current track 

next (optimal) sector to service 

highest sector number in current 

track 

buffer pointer lo address 

pointer to active values In header 

table 

track currently being formatted 

temporary storage of job code 

error counter (format routine) 

storage of current job number (DC) 



port b data register 
port a data register 
port b data direction register 
timer 1 write latch/read counter 
timer 1 trigger tlcl/tlcl transfer 
auxiliary control register 
peripheral control register 
interrupt flag register 
interrupt enable register 



port a data register 

port a data register 

port a data direction register 

port b data register 

port b data direction register 

timer offset 



Disk Controller Equates and Labels 



line 


addr 


object source 


code 


00091 


0080 


===> Common area i 


defines <; 


00092 


0080 






00093 


0080 




*=$0400 


00094 


0400 






00095 


0400 


tick 


*=*+l 


00096 


0401 


delay 


♦=*+l 


00097 


0402 


cutmt 


*=*+! 


00098 


0403 


jobs 


*.*+6 


00099 


0409 






00100 


0409 




*=$0499 


00101 


0499 


numsec 


♦=*+4 


00102 


049d 


gapl 


*=*+1 


00103 


049e 


gap2 


♦=*+l 


00104 


049f 






00105 


049f 




*=$04aO 


00106 


04a0 


act job 


*=*+! 


00107 


04a 1 






00108 


04a 1 






00109 


04a 1 


===> Internal labels <=== 


00110 


04a 1 






00111 


04a 1 


formt 


= $0500 


00112 


04a1 


starti 


= $fc00 



00113 04a1 



donei = $fc02 



00114 04a1 

00114 04al 

00115 04a1 



reset = $fc04 
.end 



page 



seen as $1000 by Bus Controller 

($1000) Interrupt interval counter 

($1001) delay constant drive motors 

($1002) cutout constant drive motors 

($1003) job queue for buffer 



($1099) number of sectors zone 1-4 

($109d) size of gap after sector 

header 

($109e) minimum bytes between 

sectors 



($10aO) current job number 



vector to main idling loop for disk 

controller 

vector to disk controller job 

completed 

Soft reset routine 



Disk Controller Routines 



page 



..5 



line addr object source code 



00117 

00118 

00119 

00120 

00121 

00122 

00123 

00124 

00125 

00126 

00127 

00128 

00129 

00130 

00131 

00132 

06133 

00134 

00135 

00136 

00137 

00138 

00139 

00140 

00141 

00142 

00143 

00144 

00145 

00146 

00147 

00148 

00149 

00150 

00151 

00152 

00153 

00154 

00155 

00156 

00157 

00158 

00159 

00160 

00161 

00162 

00163 

00164 

00165 

00166 

00167 

00168 

00169 



04a 1 

04a 1 

04a 1 

fcOO 

fcOO 

fcOO 

fcOO 

fcOO 

fc02 

fc02 

fc02 

fc02 

fc02 

fc04 

fc04 

fc04 

fc04 

fc04 

fc07 

fc09 

fc09 

fc09 

fc09 

fc09 

fc09 

fc09 

fc09 

fcOb 

fcOc 

fcOd 

fcIO 

fc12 

fc14 

fcl6 

fcl8 

fclb 

fclc 

fcle 

fc20 

fc22 

fc25 

fc27 

fc29 

fc2b 

fc2d 

fc2f 

fc31 

fc33 

fc35 

fc37 

fc39 

fc3a 

fc3c 



* = $fcOO 

»==> vector to main idling loop for disk controller <== 
54 fc startl .word start DC scanning job queue 

===> vector to disk controller job completed <»== 

08 ff donel .word error Terminate disk controller routines 



===> Soft reset routine <»== 

ad 00 04 reset Ida tick 
dO fb bne reset 



===> Power-on reset <= 



a2 3f 
9a 
d8 

8e 00 04 
a9 00 
95 00 
d5 00 
dO fe 
9d 03 04 
ca 

10 f4 
86 40 
86 42 
8e 02 
86 81 
86 la 
a9 07 
85 83 
a9 fc 
85 4c 
a9 92 
85 4e 
a9 01 
85 4b 
4a 

85 44 
85 16 



04 



resel Idx 
txs 
eld 
stx 
Ida 

rese22 sta 
cmp 

rese2 bne 
sta 
dex 
bpl 
stx 
stx 
stx 
stx 
stx 
Ida 
sta 
Ida 
sta 
Ida 
sta 
Ida 
sta 
Isr 
sta 
sta 



#$3f 



Interrupt interval counter 
Soft reset routine 



tick 

#$00 

irqcnt.x 

irqcnt.x 

rese2 

jobs.x 

rese22 

via+prb 

via+ddrb 

cutmt 

rriot+drega 

f tnum 

#$07 

rriot+dregb 

#readj 

via+pcr 

#$92 

via+ier 

#$01 

via+acr 

a 

via+tllcl 

bufpt 



reset the stack 



interrupt interval counter 

irq counter lo 
irq counter lo 

job queue for buffer 



port b data register 
port b data direction register 
cutout constant drive motors 
port a data direction register 
track currently being formatted 

port b data direction register 

peripheral control register 

interrupt enable register 

auxiliary control register 

timer 1 write latch/read counter 
buffer pointer lo address 



Disk Controller Routines 



page 



..6 



line addr object 



source code 



00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 

00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 



fc3e 
fc40 
fc43 
fc45 
fc47 
fc49 
fc4b 
fc4d 
fc50 
fc52 
fc54 
fc54 
fc54 
fc54 
fc54 
fc56 
fc57 
fc5a 
fc5c 
fc5e 

fc60 
fc62 
fc65 
fc65 
fc65 
fc65 
fc65 
fc67 
fc68 
fc6a 
fc6b 
fc6d 



00203 
00204 

00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 



fc72 
fc74 

fc77 
fc79 
fc7b 
fc7e 
fc80 
fc80 
fc80 
fc80 
fc80 
£c82 
fc84 
fc86 
fc88 
fc8a 



a9 Of 
8d 00 04 
85 8f 
a9 80 
85 03 
85 04 
a9 32 
8d 01 
a9 04 
85 19 



04 



Ida #$0f 

sta tick 

sta rriot+tlmer 

Ida Ireadc 

sta drvst 

sta drvst+l 

Ida #$32 

sta delay 

Ida #$04 

sta hdrpt+1 



Interrupt interval counter 
timer offset 

drive status (0/1) 



delay constant drive motors 



===> DC scanning job queue, waiting for something to do <== 



aO Oe start Idy #$0e 

58 startl cli 

b9 03 04 Ida jobs.y 

10 31 bpl start5 

c9 dO cmp #jumpc 

do 05 bne start2 

84 If sty jobnum 

4c 20 fd jmp exl 



initialize buffer pointer to 14 

is there a job for buffer in .Y? 
Decrement job queue pointer 

Mask out drive number, test if motor 

running 

storage of current job number 

Execute job in data buffer 



===> Mask out drive number, test if motor running <== 

mask out drive number 



00202 fc70 fO Oe 



29 01 start2 and #$01 

aa tax 

85 12 sta drive 

78 sei 

a5 40 Ida vla+prb 

3d ea ff and andc.x 

beq start3 

a5 40 Ida vla+prb 

5d ea ff eor andc,x 

85 40 sta vla+prb 

a5 00 Ida irqcnt 

6d 01 04 adc delay 

95 01 sta mtrtra.x 



current drive 

port b data register 

acceleration/deceleration bits drive 

0/1 

Walt for motor turned on and head 

positioned (irq) 

port b data register 

acceleration/deceleration bits drive 

0/1 

port b data register 

irq counter lo 

delay constant drive motors (32) 

motor timing drive 0/1 (about 1.5s) 



==> Wait for motor turned on and head positioned (irq) <== 



b5 03 starts Ida drvst, x 
30 06 brai start4 

a5 00 Ida irqcnt 

95 01 sta mtrtm.x 

b5 03 Ida drvst, x 

Oa start4 asl a 



set startup flag 

irq counter lo 

motor timing drive 0/1 

drive status (0/1) 



Disk Controller Routines 



page 



...7 



line addr object source code 



00219 fc8b 10 05 



bpl que 



00220 

00221 

00222 

00223 

00224 

00225 

00226 

00227 

00228 

00229 

00230 

00231 

00232 

00233 

00234 

00235 

00236 

00237 

00238 

00239 

00240 

00241 

00242 

00243 

00244 

00245 

00246 

00247 

00248 

00249 

00250 

00251 

00252 

00253 

00254 

00255 

00256 

00257 

00258 

00259 

00260 

00261 

00262 

00263 

00264 

00265 

00266 

00267 

00268 

00269 



fc8d 
fc8d 
fc8d 
fc8d 
fc8d 
fc8e 
fc90 
fc92 
fc92 
fc92 
fc92 
fc92 
fc93 
fc95 
fc97 
fc99 
fc9b 
fc9b 
fc9b 
fc9b 
fc9b 

fc9e 

fcaO 

fca2 

fca4 

fca6 

fcaS 

fcaa 

fcac 

fcaf 

fcaf 

fcaf 

fcaf 

fcaf 

fcbl 

fcb3 

fcb5 

fcb7 

fcb8 

fcba 

fcbc 

fcbe 

fccO 

feci 

fcc3 

fcc5 

fcc7 

fcc9 

fccb 

feed 



Loop to check job queue for step 
command 



===> Decrement job queue pointer <=== 



88 starts dey 

'0 c6 bpl starti 

dO c2 start6 bne start 



==> Loop to check Job queue <= 



DC scanning Job queue 



58 

a9 40 
85 08 
aO Oe 
84 If 



que 



ell 

Ida fbumpj 
sta work 
Idy #$0e 
sty jobnum 



temporary workspace 

storage of current Job number 



=> Check if Job for buffer (bit 7 = 1 ) <• 



20 a5 fd quel Jsr setjob 



10 2f 
29 01 
c5 12 
dO 29 
a5 le 
c9 40 
do 03 
4c 2a 



fd 



bpl que2 
and l$01 
cmp drive 
bne que2 
Ida Job 
crap IbumpJ 
bne que4 
Jmp bump 



Set pointers in header buffer 
according to Job code 
Check other jobs, bump head 
mask number to see if 
current drive 

Check other jobs, bump head 
temporary storage of job code 

Calculate distance to next track 
Position head (bump to track 1) 



===> Calculate distance to next track <== 



b5 03 
29 3f 
85 13 
fO 3d 
38 

fl 18 
fO 38 
85 Oa 
10 05 
18 

49 ff 
69 01 
c5 08 
bO 06 
85 08 
a 5 Oa 
85 09 



que4 



que5 



Ida drvst.x 
and j|f$3f 
sta track 
beq gotu 
sec 

sbc (hdrpt),y 
beq gotu 
sta nxtrk 
bpl que5 
clc 

eor #$ff 
adc #$01 
crap work 
bcs que2 
sta work 
Ida nxtrk 
sta etrack 



drive status (0/1) 

current track 

Check position of track 

calculate distance 

are we already on this track? 

Check position of track 

number of steps to the track we want 

check if another job Is closer 



temporary workspace 

Check other jobs, bump head 

temporary workspace 

next track to move head to 

current track 



Disk Controller Routines 



page 



line 


addr 


object 


source 


: code 


00270 


fccf 










00271 


fccf 










00272 


fccf 


===> Check 


other 


jobs, 


, bump head < 


00273 


fccf 










0027A 


fccf 


c6 If 


que2 


dec 


Jobnum 


00275 


fcdl 


10 c8 




bpl 


quel 


00276 


fcd3 


a5 08 




Ida 


work 


00277 


fcd5 


24 09 




bit 


ctrack 


00278 


fcd7 


30 05 




bmi 


que6 


00279 


fcd9 


18 




clc 




00280 


fcda 


49 ff 




eor 


#$ff 


00281 


fcdc 


69 01 




adc 


#$01 


00282 


fcde 


85 08 


que6 


sta 


work 


00283 


fceO 


Oa 




asl 


a 


00284 


feel 


78 




sei 




00285 


fce2 


95 05 




sta 


steps, X 


00286 


fce4 


a9 40 




Ida 


Ibumpj 


00287 


fce6 


15 03 




ora 


drvst.x 


00288 


fce8 


18 




clc 




00289 


fce9 


65 08 




adc 


work 


00290 


fceb 


95 03 




sta 


drvst.x 


00291 


feed 


dO a1 


que7 


bne 


start6 


00292 


fcef 










00293 


fcef 










00294 


fcef 


f3 fc If 


tabi 


•byte $f3, $fc. 


00295 


fcf2 


19 12 








00296 


fcf4 










00297 


fcf4 










00298 


fcf4 


===> Check poaiti 


on of track <== 


00299 


fcf4 










00300 


fcf4 


b5 03 


gotu 


Ida 


drvst.x 


00301 


fcf6 


30 f5 




bmi 


que7 


00302 


fcf8 


a2 04 




Idx 


#$04 


00303 


fcfa 


b1 18 




Ida 


(hdrpt),y 


00304 


fcfc 










00305 


fcfc 










00306 


fcfc 


==> Determine zone <= 


ca 


00307 


fcfc 










00308 


fcfc 


dd ef fc 


gotul 


cmp 


tabl.x 


00309 


fcff 


ca 




dex 




00310 


fdOO 


bO fa 




bcs 


gotul 


00311 


fd02 


bd 99 04 




Ida 


numsec , x 


00312 


fd05 


85 15 




sta 


sectr 


00313 


fd07 


8a 




txa 




00314 


fdOB 


Oa 




asl 


a 


00315 


fd09 


85 08 




sta 


work 


00316 


fdOb 


a5 82 




Ida 


rriot+oregb 


00317 


fdOd 


29 f8 




and 


#$f8 


00318 


fdOf 


05 08 




ora 


work 


00319 


fdll 


05 12 




ora 


drive 



storage of current job number 
Check if job for buffer (bit 7=1) 
temporary workspace 
current track 



temporary workspace 



steps to move to desired track 
(0-127 in, >127 out) 



drive status (0/1) 

temporary workspace 
drive status (0/1) 



drive status (0/1) 



pointer to active values in header 
table 



Determine zone 

number of sectors zone 1-4 

highest sector number in current 

track 



temporary workspace 
port b data register 

temporary workspace 
current drive 



Disk Controller Routines 



page 



line 


addr 


object 


source code 


00320 


td\3 


85 82 




3ta 


rriot+oregb 


00321 


fd15 


a6 12 




idx 


drive 


00322 


fdl7 


a5 1e 




Ida 


job 


00323 


fdl9 


c9 eO 




cmp 


#exec 


00324 


fdlb 


fO 03 




beq 


exi 


00325 


fdld 


4c 82 £e 




jrap 


seek 


00326 


fd20 










00327 


fd20 










00328 


fd20 


»»=> Execute Job 


In data buffer <> 


00329 


fd20 










00330 


fd20 


a5 If 


exi 


Ida 


jobnum 


00331 


fd22 


18 




clc 




00332 


fd23 


69 05 




adc 


#$05 


00333 


fd25 


85 17 




sta 


bufpt+1 


00334 


fd27 


6c 16 00 




Jmp (bufpt) 


00335 


fd2a 










00336 


fd2a 










00337 


fd2a 


==> Position head (bump to track 


00338 


fd2a 










00339 


fd2a 


78 


bump 


sei 




00340 


fd2b 


a9 cl 




Ida 


Ibmpfl 


00341 


fd2d 


95 03 




sta 


drvst.x 


00342 


fd2f 


a9 Of 




Ida 


#$0f 


00343 


fd31 


3d ec ff 




and 


andd.x 


00344 


fd34 


05 40 




ora 


via+prb 


00345 


fd36 


85 40 




sta 


via+prb 


00346 


fd38 


a9 8c 




Ida 


#stpcnt 


00347 


fd3a 


95 05 




sta 


steps, X 


00348 


£d3c 


4c c6 fe 




Jmp 


done 


00349 


fd3f 










00350 


fd3f 










00351 


£d3f 


=»> Optimize job (1) 


<== 


00352 


fd3f 










00353 


fd3f 


a9 7f 


fsnuml 


Ida 


#$7f 


00354 


fd41 


85 Oc 




sta 


csect 


00355 


fd43 


a5 10 




Ida 


stab+3 


00356 


fd45 


18 




clc 




00357 


fd46 


69 02 




adc 


#$02 


00358 


£d48 


c5 15 




cmp 


sectr 


00359 


fd4a 


90 02 




bcc 


fsnum2 


00360 


fd4c 


a9 00 




Ida 


#$00 


00361 


fd4e 










00362 


fd4e 










00363 


fd4e 


===> Check 


queue 


for best job to d 


00364 


fd4e 










00365 


fd4e 


85 14 


fsnum2 


sta 


nexts 


00366 


fd50 


a2 Oe 




Idx 


#$0e 


00367 


fd52 


86 If 




stx 


jobnum 


00368 


fd54 


a2 ff 




Idx 


#$ff 


00369 


fd56 











port b data register 

current drive 

temporary storage of job code 

execute code in buffer when up to 

speed and head ready 

Execute job in data buffer 

Read sector header and compare ID 



storage of current job number 



buffer pointer hi address 
buffer pointer lo address 



indicate head is stepping 
drive status (0/1) 

motor timing bits drive 0/1 
port b data register 
port b data register 



steps to move to desired 

(0-127 in, >127 out) 

DC message 1, OK (BC: 00) 



track 



last sector read 

sector number in block header 



highest sector number in current 

track 

Check queue for best job to do next 



next (optimal) sector to service 
storage of current job number 



Disk Controller Routines 



page ... 1 



line addr object source code 



00370 fd56 

00371 fd56 20 a5 fd 



fsnura3 jsr setjob 



00372 


fd59 


10 33 


bpl 


fsnumS 


00373 


fd5b 


85 


08 


sta 


work 


00374 


fd5d 


b1 


18 


Ida 


(hdrpt),y 


00375 


fd5f 


c5 


13 


cmp 


track 


00376 


fd61 


dO 


2b 


bne 


fsnura5 


00377 


fd63 


a5 


08 


Ida 


work 


00378 


fd65 


29 01 


and 


#$01 


00379 


fd67 


c5 


12 


crap 


drive 


00380 


fd69 


dO 


23 


bne 


fsnura5 


00381 


fd6b 


98 




tya 




00382 


fd6c 


c9 


eO 


crap 


#exec 


00383 


fd6e 


fO 


1e 


beq 


fsnum5 


00384 


fd70 


c8 




iny 




00385 


fd71 


38 




sec 




00386 


fd72 


b1 


18 


Ida 


(hdrpt).y 


00387 


fd74 


e5 


14 


sbc 


nexts 


00388 


fd76 


10 03 


bpl 


fsnum4 


00389 


fd78 


18 




clc 




00390 


fd79 


65 


15 


adc 


sectr 


00391 


fd7b 


85 


Ob 


fsnuffl4 sta 


csectr 


00392 


fd7d 


38 




sec 




00393 


fd7e 


e5 


Oc 


sbc 


csect 


00394 


fd80 


10 


Oc 


bpl 


fsnuin5 


00395 


fd82 


a6 


If 


Idx 


jobnum 


00396 


fd84 


a5 


Ob 


Ida 


csectr 


00397 


fd86 


85 


Oc 


sta 


csect 


00398 


fd88 


8a 




txa 




00399 


fd89 


18 




clc 




00400 


fd8a 


69 


05 


adc 


#$05 


00401 


fd8c 


85 


17 


sta 


bufpt+1 


00402 


fd8e 


c6 


If 


fsnum5 dec 


Jobnum 


00403 


fd90 


10 


c4 


bpl 


fsnum3 


00404 


fd92 


8a 




txa 




00405 


fd93 


10 03 


bpl 


fsnuni6 


00406 


fd95 


4c 


54 fc 


Jnip 


start 


00407 


fd98 










00408 


fd98 










00409 


fd98 


8e aO 04 


fsnuiii6 stx 


act Job 


00410 


fd9b 


86 


If 


stx 


Jobnum 


00411 


fd9d 


20 


a5 fd 


jsr 


setjob 


00412 


fdaO 


a5 


1e 


Ida 


Job 


00413 


fda2 


4c 


c4 fd 


Jmp 


reed 


00414 


fdaS 










00415 


fda5 










00416 


fdaS 











Set pointers in header buffer 
according to Job code 

temporary workspace 

pointer to active values in header 

table 

current track 

temporary workspace 
mask out drive number 
current drive 



execute code in buffer when up to 
speed and head ready 



pointer to active values in header 

table 

next (optimal) sector to service 



highest sector number in current 

track 

highest sector to read 

last sector read 

storage of current Job number 
highest sector to read 
last sector read 



buffer pointer hi address 
storage of current job number 



DC scanning Job queue 



current Job number 
storage of current Job number 
Set pointers in header buffer 
according to Job code 
temporary storage of job code 
Read sector into buffer (code 00) 



Disk Controller Routlr 



page ...11 



line addr object source code 



00417 
00418 
00419 
00420 
00421 
00422 
00423 
00424 
00425 
00426 
00427 
00428 
00429 

00430 
00431 
00432 
00433 
00434 
00435 
00436 
00437 
00438 

00439 

00440 

00441 

00442 

00443 

00444 

00445 

00446 

00447 

00448 

00449 

00450 

00451 

00452 

00453 

00454 

00455 

00456 

00457 

00458 

00459 

00460 

00461 

00462 

00463 

00464 

00465 

00466 

00467 



fdaS 
fdaS 
fda5 
fda7 
fdaa 
fdab 
fdad 
fdaf 
fdbO 
fdbl 
fdb2 
fdb3 
fdb5 

fdb7 
fdb9 
fdba 
fdbb 
fdbb 
fdbb 
fdbb 
fdbb 
fdbd 

fdbf 

fdcl 

fdc4 

fdc4 

fdc4 

fdc4 

fdc4 

fdc6 

fdc8 

fdcb 

fdcb 

fdcb 

fdcb 

fdcb 

fdcd 

fdcf 

fddl 

fdd3 

fdd5 

fdd7 

fddS 

fdda 

fddd 

fddd 

fddd 

fddd 

fddd 

fddf 

fdel 



===> Set pointers in header buffer according to job code <= 



a4 If 

b9 03 04 

48 

29 70 

85 le 

98 

Oa 

Oa 

Oa 

69 21 

85 18 

aO 02 

68 

60 



setjob Idy Jobnum 
Ida jobs.jr 
pha 

and #$70 
sta job 
tya 
asl a 
asl a 
asl a 

adc #bufpnt 
sta hdrpt 

Idy #$02 

pla 

rts 



storage of current job number 
job queue for buffer 



temporary storage of job code 



pointer to active values in header 
table 



===> Optimize job (?) <== 

aO 03 fsnura Idy #$03 

bl 18 Ida (hdrpt), y 

85 10 sta stab+3 

*c 3f fd Jmp fsnuml 



sector offset 

pointer to active values In header 

table 

sector number in block header 

Optimize job (1) 



===> Read sector into buffer (code 00) <== 



c9 00 
dO 28 
20 dd fd 



reed crap #$00 
bne wprot 
jsr dstrt 



verify write protect 
Find a data block ID (07) 



==> Walt for data byte to be ready <== 



24 4d 
10 fc 
a5 41 
91 16 
45 08 
85 08 
c8 

dO f1 
4c 6b fe 



1100 



bit via+ifr 
bpl 1100 
Ida via+pra 
sta (bufpt),y 
eor work 
sta work 
iny 

bne 1100 
jrap 1211 



interrupt flag register 
Wait for data byte to be ready 
port a data register 
buffer pointer lo address 
temporary workspace 
temporary workspace 

Wait for data byte to be ready 



=> Find a data block ID (07) <== 



aO 00 
84 08 
20 d3 fe 



dstrt Idy #$00 
sty work 
Jsr srch 



temporary workspace 

Find specified data block header 



Disk Controller Routines 



page 



.12 



line 


addr 


object 




source 


code 


00468 


fde4 


20 3e 


ff 




jsr synci 


00469 


fde7 


c9 07 






crap llibid 


00470 


fde9 


fO 04 






beq dstrtx 


00471 


fdeb 


a9 04 






Ida dlnodblk 


00472 


fded 


dO Ob 






bne errx 


00473 


fdef 










00474 


fdef 










00475 


fdef 


===> Found 


a good 


block <== 


00476 


fdef 










00477 


fdef 


60 




dstrtx 


rts 


00478 


fdfO 










00479 


fdfO 










00480 


fdfO 


===> Verify write 


protect <== 


00481 


fdfO 










00482 


fdfO 


c9 20 




wprot 


cmp IverfyJ 


00483 


fdf2 


10 63 






bpl verfy 


00484 


fdf4 


a5 82 






Ida rriot+or< 


00485 


fdf6 


29 08 






and #$08 


00486 


fdfS 


fO 03 






beq rite 


00487 


fdfa 










00488 


fdfa 










00489 


fdfa 


===> error 


exit <■ 


saa 


00490 


fdfa 










00491 


fdfa 


4c 08 


ff 


errx 


jmp error 


00492 


fdfd 










00493 


fdfd 










00494 


fdfd 


==.> write 


buffer 


to disk <== 


00495 


fdfd 










00496 


fdfd 


a9 10 




rite 


Ida fwritej 


00497 


fdff 


85 4e 






sta via+ier 


00498 


feOI 


20 d3 


fe 




jsr srch 


00499 


fe04 


ae 9d 


04 




Idx gapl 


00500 


fe07 


ca 






dex 


00501 


fe08 










00502 


fe08 










00503 


fe08 


==-> Check 


OFF by 


tea <=-»= 


00504 


fe08 










00505 


fe08 


24 4d 




1200 


bit via+ifr 


00506 


feOa 


10 fc 






bpl 1200 


00507 


feOc 


24 41 






bit via+pra 


00508 


feOe 


ca 






dex 


00509 


feOf 


dO f7 






bne 1200 


00510 


fell 


a9 de 






Ida #$de 


00511 


fe13 


85 4c 






sta via+pcr 


00512 


fel5 


a9 dc 






Ida #$dc 


00513 


fe17 


a2 ff 






Idx #$ff 


00514 


fe19 


20 79 


ff 




jsr out 


00515 


felc 


20 79 


ff 




jsr out 


00516 


felf 


20 79 


ff 




jsr out 


00517 


fe22 


24 4d 




1202 


bit via+ifr 


00518 


fe24 


10 fc 






bpl 1202 


00519 


fe26 


24 41 






bit via+pra 


00520 


fe28 


85 4c 






sta via+pcr 



Wait for a data block sync mark 
found a good block 
error exit 



Compare sector with buffer 
port b data register 

write buffer to disk 



Terminate disk controller routines 



interrupt enable register 

Find specified data block header 

size of gap after sector header 



interrupt flag register 
Check OFF bytes 
port a data register 

Check OFF bytes 

peripheral control register 



Write character in .X to disk 
Write character in .X to disk 
Write character In .X to disk 
interrupt flag register 

port a data register 
peripheral control register 



Disk Controller Routines 



page ,.,13 



line 


addr 


object 


source code 


00521 


fe2a 


a9 07 




Ida 


Ibid 


00522 


fe2c 


85 80 




sta 


rriot+oreaa 


00523 


fe2e 


aO 00 




Idy #$00 


00524 


fe30 


84 08 




sty 


work 


00525 


fe32 










00526 


£e32 










00527 


fe32 


24 4d 


1203 


bit 


via+ifr 


00528 


fe34 


10 fc 




bpl 1203 


00529 


fe36 


24 41 




bit 


via+pra 


00530 


fe38 


b1 16 




Ida 


(bufpt),y 


00531 


fe3a 


85 80 




sta 


rriot+orega 


00532 


fe3c 


45 08 




eor 


work 


00533 


fe3e 


85 08 




sta 


work 


00534 


fe40 


c8 




Iny 




00535 


fe41 


dO ef 




bne 


1203 


00536 


fe43 


aa 




tax 




00537 


fe44 


20 79 ff 




jar 


out 


00538 


fe47 


20 58 ff 




jsr 


1204 


00539 


fe4a 


a4 If 




Idy Jobnum 


00540 


fe4c 


b9 03 04 




Ida 


jobs.y 


00541 


fe4f 


49 30 




eor 


#$30 


00542 


fe51 


99 03 04 




sta 


Jobs.y 


00543 


fe54 


4c bb fd 




Jrap 


fsnum 


00544 


fe57 










00545 


fe57 










00546 


fe57 


==> Compare sector with buffer <= 


00547 


fe57 










00548 


fe57 


20 dd fd 


verfy 


Jar 


dstrt 


00549 


fe5a 


24 4d 


1210 


bit 


via+ifr 


00550 


£e5c 


10 fc 




bpl 


1210 


00551 


feSe 


a5 41 




Ida 


via+pra 


00552 


fe60 


d1 16 




cmp 


(bufpt),y 


00553 


fe62 


dO la 




bne 


1212 


00554 


fe64 


45 08 




eor 


work 


00555 


fe66 


85 08 




sta 


work 


00556 


fe68 


c8 




iny 




00557 


fe69 


dO ef 




bne 


1210 


00558 


fe6b 


20 51 ff 


1211 


Jsr 


byte 


00559 


fe6e 


c5 08 




cmp 


work 


00560 


fe70 


fO 04 




beq 


12111 


00561 


fe72 


a9 05 




Ida 


#badbch 


00562 


fe74 


dO Oa 




bne 


1213 


00563 


fe76 


a9 10 


12111 


Ida #$10 


00564 


fe78 


24 4d 




bit 


via+ifr 


00565 


fe7a 


fO 4a 




beq 


done 


00566 


fe7c 


dO 02 




bne 


1213 


00567 


fe7e 










00568 


fe7e 










00569 


£e7e 











port a data register 
temporary workspace 

interrupt flag register 

port a data register 
buffer pointer lo address 
port a data register 
temporary workspace 
temporary workspace 



Write character in .X to disk 
write byte to disk 
storage of current Job number 
Job queue for buffer 

job queue for buffer 
Optimize Job (2) 



Find a data block ID (07) 
interrupt flag register 

port a data register 

buffer pointer lo address 

DC error 7, verify error (BC: 25) 

temporary workspace 

temporary workspace 



Read data byte following sync mark 
to accumulator 
temporary workspace 

always 

interrupt flag register 
DC message 1, OK (BC: 00) 



Disk Controller Routines 



page 



.14 



line addr object 



source code 



00570 
00571 
00572 
00573 
00574 
00575 
00576 
00577 
00578 
00579 
00580 
00581 
00582 
00583 
00584 
00585 
00586 
00587 
00588 
00589 
00590 
00591 
00592 
00593 
00594 

00595 
00596 
00597 
00598 
00599 
00600 

00601 
00602 
00603 
00604 
00605 
00606 

00607 
00608 
00609 
00610 

00611 
00612 
00613 
00614 
00615 
00616 
00617 
00618 



fe7e 
fe7e 
fe7e 
fe80 
fe82 
fe82 
fe82 
fe82 
fe82 
fe84 
fe86 
fe88 
fe8b 
fe8d 
feSd 
fe8d 
feSf 
fe91 
fe93 
fe96 
fe98 
fe9a 
fe9b 
fe9d 
fe9f 

feal 
fea3 
feaS 
fea7 
fea9 
feab 

fead 
leaf 
leaf 
feaf 
feaf 
feaf 

febl 
feb4 
feb6 
feb7 

feb9 
febc 
febc 
febc 
febc 
febc 
febc 
febc 



"> DC error 7, verify error (BC: 25) <= 



a9 07 
dO 46 



1212 
1213 



Ida fwverer 
bne err2 



=> Read sector header and compare ID <= 



a9 00 
85 08 
a2 06 
20 02 ff 
aO 04 



24 4d 
10 fc 
a5 41 
99 Od 00 
45 08 
85 08 
88 

10 fO 
c9 00 
dO 2a 

a5 Of 
a6 12 
95 03 
a5 1e 
c9 30 
fO Of 

aO 01 



seek 



1250 



Ida l$00 
sta work 
Idx #$06 
jsr head 
Idy #$04 



bit vla+ifr 
bpl 1250 
Ida via+pra 
sta stab, 7 
eor work 
sta work 
dey 

bpl 1250 
cmp #$00 
bne cserr 

Ida stal)+2 
Idx drive 
sta drvst.x 
Ida Job 
cmp Iseekj 
beq eseek 

Idy #$01 



temporary workspace 
Find next sector header 



interrupt flag register 

port a data register 
current block header 
temporary workspace 
temporary workspace 



DC error 9, header checksum error 

(BC: 27) 

track number in block header 

current drive 

drive status (0/1) 

temporary storage of Job code 

Transfer sector header to header 
buffer 



=> Compare block header ID with current (disk) ID <• 
b1 18 1252 Ida (hdrpt),y 



d9 Od 00 
dO 19 
88 
10 f6 

4c 3f fd 



cmp stab.y 

bne iderr 

dey 

bpl 1252 

Jmp fsnumi 



pointer to active values in header 

table 

current block header 

X error 11, wrong disk ID (BC: 29) 

Compare block header ID with current 
(disk) ID 
Optimize Job (1) 



===> Transfer sector header to header buffer <== 

Note: these will be recorded on disk in reverse order! 
aO 04 eseek Idy #$04 IDl , ID2, track, sector, parity 



Disk Controller Routines 



page 



.15 



line addr object source code 



00619 
00620 

00621 
00622 
00623 
00624 
00625 
00626 
00627 
00628 
00629 
00630 
00631 
00632 
00633 
00634 
00635 
00636 
00637 
00638 
00639 
00640 
00641 
00642 
00643 
00644 
00645 
00646 
00647 
00648 
00649 
00650 
00651 

00652 
00653 

00654 
00655 

00656 
00657 
00658 
00659 
00660 
00661 
00662 
00663 
00664 
00665 
00666 
00667 



febe 
feci 

fec3 
fec4 
fec6 
fec6 
fec6 
fec6 
fec6 
fec8 
fecb 
fecb 
fecb 
fecb 
fecb 
feed 
fecf 
fecf 
fecf 
fecf 
fecf 
fedl 
fed3 
fed3 
fed3 
fed3 
fed3 
fed5 
fed 7 
fed 7 
fed7 
fed? 
fed 7 

fed9 
feda 

fedc 
fede 

feeO 
fee2 
fee4 
fee4 
fee4 
fee4 
fee4 
fee7 
fee9 
feeb 
feed 
feef 



b9 Od 00 
91 18 

88 
10 f8 



1251 



Ida stab.y 
sta (hdrpt),y 

dey 

bpl 1251 



current block header 

pointer to active values In header 

table 



=-> DC message 1, OK (BC: 00) <== 

a9 01 done Ida IgoodJ 
4c 08 ff err2 Jrap error 



Terminate disk controller routines 



"==> DC error 9, header checksum error (BC: 27) <== 



a9 09 cserr Ida fbadhch 
dO f9 bne err2 



header block checksum error 



==> DC error 11, wrong disk ID (BC: 29) <- 



a9 Ob 

dO f5 



Iderr Ida Ibadld 
bne err2 



===> Find specified data block header <— = 

sector offset 



aO 03 
a9 00 



srch Idy #$03 
Ida #$00 



===■> Calculate block header checksum and put in header buffer <= 



51 18 1412 eor (hdrpt),y 

88 dey 

10 fb bpl 1412 

aO 04 Idy #$04 

91 18 sta (hdrpt),y 

a4 If Idy Jobnum 

a2 5a Idx #$5a 



pointer to active values in header 
table 

Calculate block header checksum and 

put in header buffer 

parity offset 

pointer to active values in header 

table 

storage of current job number 



=> Compare next sector header with header buffer <= 



20 02 ff 
aO 04 
24 4d 
10 fc 
a5 41 
d1 18 



1410 



1411 



jsr head 
Idy #$04 
bit via+ifr 
bpl 1411 
Ida via+pra 
cmp (hdrpt),y 



Find next sector header 

interrupt flag register 

port a data register 

pointer to active values in header 

table 



Disk Controller Routines 



page 



.16 



line addr object source code 



00668 let] dO fl 



00669 

00670 

00671 

00672 

00673 

00674 

00675 

00676 

00677 

00678 

00679 

00680 

00681 

00682 

00683 

00684 

00685 

00686 

00687 

00688 

00689 

00690 

00691 

00692 

00693 

00694 

00695 

00696 

00697 

00698 

00699 

00700 

00701 

00702 

00703 

00704 

00705 

00706 

00707 

00708 

00709 

00710 

00711 

00712 

00713 

00714 

00715 

00716 

00717 

00718 

00719 



fef3 

fef4 

fef6 

fef7 

fef9 

fefb 

fefd 

feff 

ffOl 

ff02 

ff02 

ff02 

ff02 

ff02 

ff03 

ff04 

ff06 

ff08 

ff08 

ff08 

ff08 

ff08 

ffOa 

ffOd 

ffOe 

fflO 

ffl2 

ffl5 

ffl7 

ffl8 

ffl9 

ffib 

ffle 

ffle 

ffle 

ffle 

ffle 

ff20 

ff21 

ff24 

ff24 

ff24 

ff24 

ff24 

ff27 

ff29 

ff2b 

ff2c 

ff2c 

ff2c 

ff2e 



88 

10 f3 
c8 

a5 40 
09 80 
85 40 
29 7f 
85 40 
60 



bne 1410 

dey 

bpl 1411 

Iny 

Ida via+prb 

era #$80 

sta via+prb 

and #$7f 

sta via+prb 

rts 



Compare next sector header with 
header buffer 



port b data register 
port b data register 
port b data register 



=■> Find next sector header <= 



58 
ca 

10 le 
a9 02 



head 



ell 

dex 

bpl 1420 

Ida #nohdr 



Find start of sector header (08) 
Just in easel 



=> Terminate disk controller routines <—==• 



a4 1 f error Idy Jobnum 

99 03 04 sta Jobs.y 

48 pha 

a6 12 Idx drive 

a5 00 Ida Irqcnt 

6d 02 04 adc cutmt 

95 01 sta mtrtra.x 

68 pla 

4a Isr a 

dO 03 bne 1421 

4c bb fd Jmp fsnum 



»=>=> Abort after error <■■ 
1421 



a2 3f 

9a 

4c 54 fc 



Idx #$3f 

txs 

Jmp start 



storage of current Job number 
Job queue for buffer 

current drive 

Irq counter lo 

cutout constant drive motors 

motor timing drive 0/1 



Abort after error 
Optimize Job (2) 



reset the stack 

DC scanning Job queue 



=•=> Find start of sector header (08) <-== 

Wait for a data block sync mark 
Find next sector header 



20 3e ff 1420 Jsr synci 

c9 08 cmp #hbld 

do d7 bne head 

60 rts 



24 82 
50 Od 



1423 bit rriot+oregb port b data register 
bvc 1424 



Disk Controller Routines 



page ...17 



line addr object source code 



00720 

00721 

00722 

00723 

00724 

00725 

00726 

00727 

00728 

00729 

00730 

00731 

00732 

00733 

0O73A 

00735 

00736 

00737 

00738 

00739 

00740 

00741 

00742 

00743 

00744 

00745 

00746 

00747 

00748 

00749 

00750 

00751 

00752 

00753 

00754 

00755 

00756 

00757 

00758 
00759 
00760 
00761 
00762 
00763 
00764 
00765 
00766 
00767 
00768 
00769 
00770 



ff30 

ff32 

ff34 

ff36 

ff38 

ff39 

ff3b 

ff3d 

ff3e 

ff3e 

f£3e 

ff3e 

ff3e 

ff3e 

ff3e 

ff3e 

ff3e 

ff3e 

ff3e 

ff3f 

ff41 

f£43 

ff45 

ff45 

ff45 

ff45 

ff45 

ff47 

ff49 

ff4b 

f£4d 

ff4f 

ffSI 

ff51 

ff51 

ff51 

ff51 

ff53 

ff55 
ff57 
ff58 
ff58 
ff58 
ff58 
ff58 
ff5b 
ff5d 
ff60 
ff62 
f£62 
f£62 



24 4d 
10 fS 
24 41 
24 40 
ca 

dO fl 
24 82 
60 



1424 



bit via+ifr 

bpl 1423 

bit via+pra 

bit via+prb 

dex 

bne 1423 

bit rriot+oregb port b data register 
rts 



Interrupt flag register 

port a data register 
port b data register 



Walt for a data block sync mark <— - 

A sync mark Is ten or more consecutive 1 's written onto the disk. 
They are used to identify the start of a block of information 
recorded on the disk. The first character following a sync mark 
is used to determine whether this is a header block ($08) or a 
data block ($07). 



78 

a9 dO 
85 45 
a9 03 



syncl 



sel 

Ida #$dO 
sta via+tlch 
Ida #nosync 



=■> Read timer, test sync <■ 



24 45 
10 bf 
24 82 
70 f8 
24 40 
24 41 



1430 



bit via+tlch 
bpl error 
bit rriot+oregb 
bvs 1430 
bit via+prb 
bit via+pra 



allow about 20 ms before timing out 
timer 1 trigger tlcl/tlcl transfer 



test bit 7 for timeout 

Terminate disk controller routines 

port b data register 

Read timer, test sync 

port b data register 

port a data register 



-> Read data byte following sync mark to accumulator <= 



24 4d 
10 fc 

a5 41 
60 



byte 



bit via+ifr 
bpl byte 

Ida via+pra 
rts 



=> write byte to disk <== 



20 79 ff 
a2 00 
20 79 ff 
a9 fc 



1204 



jsr out 
Idx #$00 
Jsr out 
Ida Ireadj 



interrupt flag register 

Read data byte following sync mark 

to accumulator 

port a data register 



Write character in .X to disk 
Write character in .X to disk 



Disk Controller Routines 



page ...18 



line 


addr 


object 


source 


code 




00771 


ff62 


— > Read 


<-°<' 






00772 


ff62 










00773 


ff62 


24 4d 


1442 


bit Yia+ifr 


interrupt flag register 


00774 


ff64 


10 fc 




bpl 1442 


Read 


00775 


ff66 


85 4c 




sta via+pcr 


peripheral control register 


00776 


ff68 


a9 92 




Ida #$92 




00777 


ff6a 


85 4e 




sta via+ier 


Interrupt enable register 


00778 


ff6c 


20 51 ff 




Jsr byte 


Read data byte following sync mark 
to accumulator 


00779 


ff6f 


24 40 




bit via+prb 


port b data register 


00780 


ff71 


20 51 ff 




Jsr byte 


Read data byte following sync mark 
to accumulator 


00781 


ff74 


24 40 




bit vla+prb 


port b data register 


00782 


ff76 


4c 51 ff 




jmp byte 


Read data byte following sync mark 
to accumulator 


00783 


ff79 










00784 


ff79 










00785 


ff79 


=r.> Write 


1 character in .X to disk 


; <-«" 


00786 


ff79 










00787 


ff79 


24 4d 


out 


bit via+ifr 


interrupt flag register 


00788 


ff7b 


10 fc 




bpl out 


Write character in .X to disk 


00789 


ff7d 


86 80 




stx rriot+orega 


port a data register 


00790 


ff7f 


24 41 




bit vla+pra 


port a data register 


00791 


ffSl 


60 




rts 




00792 


ff82 










00793 


ff82 










00794 


ff82 


«~-> Interrupt routine (IRQ) <-= 




00795 


ff82 










00796 


ff82 


48 


irq 


pha 




00797 


ff83 


8a 




txa 




00798 


ff84 


48 




pha 




00799 


£f85 


ad 00 04 




Ida tick 


Interrupt interval counter 


00800 


ffB8 


85 8f 




sta rriot+timer 


timer offset 


00801 


ff8a 


e6 00 




inc irqcnt 


irq counter lo 


00802 


ff8c 


a2 01 




Idx #$01 




00803 


ff8e 










00804 


ff8e 










00805 


ffSe 


=—=> Select drive 1 <— 




00806 


ff8e 










00807 


ff8e 


a5 00 


irqOI 


Ida irqcnt 


irq counter lo 


00808 


ff90 


d5 01 




cmp mtrtm.x 


motor timing drive 0/1 


00809 


ff92 


dO 16 




bne lrq05 


Activate head stepping 


00810 


ff94 


bd ea ff 




Ida andc.x 


acceleration/deceleration bits drive 

0/1 

drive status (0/1) 


00811 


ff97 


16 03 




asl drvst.x 


00812 


f£99 


24 40 




bit vla+prb 


port b data register 


00813 


ff9b 


bO 08 




bcs irq04 




00814 


ff9d 


38 




sec 




00815 


ff9e 


bd ea ff 




Ida andc.x 


acceleration/deceleration bits drive 
0/1 


00816 


ffal 


45 40 




eor via+prb 


port b data register 


00817 


ffa3 


85 40 




sta via+prb 


port b data register 


00818 


ffaS 


dO 01 


irq04 


bne irq40 





Disk Controller Routines 



page ...19 



line addr object 



source code 



00819 ffa7 18 clc 

00820 ffaS 

00821 ffaS 

00822 ffaS 76 03 irq40 ror drvst.x 

00823 ffaa 

00824 ffaa 

00825 ffaa -=> Activate head stepping <= 

00826 ffaa 

00827 ffaa b5 05 irq05 Ida steps, x 



bne irq07 
Ida drvst.x 
and #$bf 
sta drvst.x 
ff jmp irq12 



00828 


ffac 


dO 09 


00829 


ffae 


b5 03 


00830 


ffbO 


29 bf 


00831 


ffb2 


95 03 


00832 


ffb4 


4c el 


00833 


ffb7 




00834 


ffb7 




00835 


ffb7 


„=> : 


00836 


ffb7 




00837 


ffb7 


Oa 


00838 


ffb8 


a5 40 


00839 


ffba 


3d ef 


00840 


ffbd 


85 07 


00841 


ffbf 


a5 40 


00842 


ffcl 


3d ec 


00843 


ffc4 


bO 07 


00844 


ffc6 


d6 05 



00848 
00849 
00850 
00851 
00852 
00853 
00854 
00855 
00856 
00857 
00858 
00859 
00860 
00861 
00862 
00863 
00864 
00865 



> Step head to next track <= 
irq07 



fc 



ff 



00845 ffc8 7d e8 ff 

00846 ffcb dO 05 

00847 ffcd f6 05 



ffcf 
ffd2 
ffd5 
ffd7 
ffd9 
ffdb 
ffdd 
ffdf 
ffel 
ffe2 
ffe4 
ffe5 
ffe6 
ffe7 
ffe8 
ffeS 
ffe8 
ffea 



fd e8 
3d ec 
05 07 
85 40 
b5 03 
30 04 
a5 00 
95 01 
ca 

10 aa 
68 
aa 
68 
40 



04 01 
20 10 



ff 
ff 



irq08 



irqIO 



lrq12 



00866 ffec Oc 03 

00867 ffee 



andb 
andc 

andd 



asl a 
Ida vla+prb 
and tabi ,x 
sta cow 
Ida via+prb 
and andd.x 
bcs irq08 
dec steps, X 

adc andb,x 
bne irqlO 
inc steps, X 

sbc andb,x 

and andd,x 

ora cow 

sta vla+prb 

Ida drvst.x 

brai lrq12 

Ida Irqcnt 

sta mtrtm.x 

dex 

bpl IrqOI 

pla 

tax 

pla 

rti 



•byte $04, $01 
.byte $20, $10 

.byte $0c, $03 



drive status (0/1) 



steps to move to desired track 
(0-127 in. >127 out) 
Step head to next track 
drive status (0/1) 

drive status (0/1) 



port b data register 

buffer for irq/motor timing bits 

port b data register 

motor timing bits drive 0/1 

steps to move to desired track 
(0-127 in, >127 out) 
step bits drive 0/1 

steps to move to desired track 

(0-127 in. >127 out) 

step bits drive 0/1 

motor timing bits drive 0/1 

buffer for irq/motor timing bits 

port b data register 

drive status (0/1) 

irq counter lo 

motor timing drive 0/1 

Select drive 1 



step bits drive 0/1 

acceleration/deceleration bits drive 

0/1 

motor timing bits drive 0/1 



Disk Controller Routines 



page 



,.20 



line addr object 

00868 ffee 18 

00869 ffef 

00870 ffef 

00871 fffc 09 fc 

00872 fffe 82 ff 

00873 0000 

00874 0000 

00875 0000 

00876 0000 

00877 0000 



source code 

.byte $18 

*=$fffc 
.word resel 
.word irq 

.end 



Power-on reset 



DC Format Routine 



page 



.21 



line addr object 



source code 



00879 
00880 
00881 
00882 
00883 
00884 
00885 
00886 
00887 
00888 
00889 
00890 
00891 

00892 
00893 
00894 
00895 
00896 
00897 
00898 
00899 
00900 



0000 
0000 
0000 
0000 
0000 
0000 
0000 
0000 
0000 
0000 
0500 
0500 
0500 

0502 
0504 
0505 
0507 
0509 
050b 
050e 
0510 
0512 



The format routine is transferred from ROM at $D000 to RAM to 
reside at $1100 in buffer #0, It is listed here with the 
addresses as seen by the Disk Controller 



00901 0514 



00902 
00903 
00904 
00905 
00906 
00907 



0516 
0517 
0517 
0517 
0517 
0517 



a5 la 

10 2f 
78 

a9 c1 
95 03 
a9 Of 
3d 9a 07 
05 40 
85 40 
a9 8c 

95 05 

58 



$0500 



fonnt Ida ftnum 



bpl fmttrk 


sel 




Ida 


#bmpfl 


sta 


drvst.x 


Ida 


#$0f 


and 


stepbt.x 


ora 


via+prb 


sta 


via+prb 


Ida 


Istpcnt 


sta 


steps, X 


ell 





track currently being formatted — 

#$FF on reset 

positive: formatting in progress 

drive status (0/1): head is stepping 

step bits drive 0/1 

port b data register 

port b data register 

initialize step counter to move head 

in drive .X 

steps to move to desired track 

(0-127 in, >127 out) 



=•> Wait until head positioned and set pointers <» 



00908 0519 dO fc 



00909 
00910 
00911 
00912 
00913 
00914 
00915 

00916 
00917 
00918 
00919 
00920 
00921 
00922 

00923 
00924 



051b 
051c 
051d 
051 e 
051 f 
0520 
0522 

0524 
0526 
0528 
0529 
052b 
052e 
0530 

0533 
0533 



b5 05 formO Ida steps, x 

bne formO 

98 tya 

Oa asl a 

Oa asl a 

Oa asl a 

18 clc 

69 21 adc #bufpnt 

85 18 sta hdrpt 

aO 00 Idy #$00 

84 If sty errcnt 

c8 iny 

84 la sty ftnum 

20 65 07 formOl jar wrtshd 

a4 If Idy jobnura 

6c 00 fc jmp (starti) 



steps to move to desired track 

(0-127 in, >127 out) 

Wait until head positioned and set 

pointers 

buffer number 



multiply by 8 

pointer lo into header table 
pointer to active values in header 
table 

error counter 

track 1 to be formatted 

Create header image for first sector 

storage of current job code number 

vector to main idling loop for disk 

controller 



DC Format Routine 



page 



.22 



line addr object source code 



00925 0533 

00926 0533 

00927 0533 

00928 0535 



00929 
00930 
00931 
00932 
00933 
00934 
00935 
00936 
00937 
00938 
00939 
00940 
00941 
00942 
00943 
00944 
00945 
00946 
00947 
00948 
00949 
00950 
00951 
00952 
00953 
00954 
00955 
00956 
00957 
00958 
00959 
00960 
00961 
00962 
00963 
00964 
00965 
00966 
00967 
00968 



0537 
0539 
053b 
053d 
053d 
053d 
053d 
053d 
053e 
0541 
0543 
0545 
0547 
054a 
054a 
054a 
054a 
054a 
054d 
054f 
0551 
0554 
0556 
0559 
055c 
055e 
0561 
0563 
0566 
0568 
056b 
056e 
0571 
0573 
0575 
0578 
0578 
0578 
0578 
0578 



===> Format a track <—» 

aO 02 fmttrk Idy #$02 

51 18 eor (hdrpt),y 

dO f2 bne formOl 

a9 00 Ida #$00 

85 If sta errcnt 



offset In header buffer to track 
pointer to active values In header 
table 

reset 

error counter 



=> Check write protect status <== 



78 fmttOl sel 

20 65 07 jsr wrtshd 

a9 08 Ida #wrprot 

25 82 and rriot+oregb 

fO 03 beq chkspd 

4c 84 06 Jmp fmterl 



=»=> Check speed <«■ 



20 80 07 
a2 ff 
a9 da 
20 2e 07 
85 4c 
20 2e 07 
20 2e 07 
a9 dc 
20 2e 
a2 Of 
20 2e 
85 4c 
20 Od 
20 3e 
20 37 07 
c9 Of 
fO 03 
4c 82 06 



07 

07 

07 
07 



chkspd Jsr 
Idx 
Ida 
Jsr 
sta 
jsr 
jsr 
Ida 
Jsr 
Idx 
Jsr 
sta 
Jsr 
Jsr 

Jsr 
cmp 
beq 



wrtnul 

#$ff 

#$da 

write 

via+pcr 

write 

write 

#$dc 

write 

#offbyt 

write 

via+pcr 

readb 

loop 

read 

#offbyt 

gaps 

fmterr 



Create header image for first sector 

bit 3 Is 1 if write protect on 

Check speed 

Permit ten tries before aborting 



Erase track by writing 32*256 nulls 



Send value in .X to output register 
peripheral control register 
Send value in .X to output register 
Send value in .X to output register 

Send value in .X to output register 

Send value in .X to output register 
peripheral control register 
Read four header bytes 
Loop to time non-sync area 
Read a data byte 

Calculate track capacity 
Format error 



«■=> Calculate track capacity <■ 
a9 11 gap 



00969 057a 18 

00970 057b 6d 9d 04 

00971 057e 85 Oa 

00972 0580 a6 15 

00973 0582 aO 00 

00974 0584 a9 00 



Ida #$11 


number of header bytes without OFF 




bytes 


clc 




adc gapl 


size of gap after sector header 


sta nxtrk 


17+9 


Idx sectr 


highest sector number in current 




track 


Idy #$00 


calculate OFF bytes for gap 


Ida #$00 





DC Format Routine 



page 



.23 



line addr object source code 



00975 0586 18 

00976 0587 65 Oa 

00977 0589 90 01 

00978 058b c8 

00979 058c c8 

00980 058d ca 

00981 058e dO f6 

00982 0590 49 ff 

00983 0592 38 

00984 0593 69 00 

00985 0595 18 



gapsi 



gaps2 



clc 

adc nxtrk 

bcc gaps2 

iny 

iny 

dex 

bne gapsi 

eor #$ff 

sec 

adc #$00 

clc 



00986 


0596 


6d aO 07 




adc countl 


00987 


0599 


bO 03 






bcs gaps3 


00988 


059b 


ce 9f 


07 




dec counth 


00989 


059e 


aa 




gaps3 


tax 


00990 


059f 


98 






tya 


00991 


05a0 


49 ff 






eor #$ff 


00992 


05a2 


38 






sec 


00993 


05a3 


69 00 






adc #$00 


00994 


05a5 


18 






clc 


00995 


05a6 


6d 9f 


07 




adc counth 


00996 


05a9 


10 03 






bpl gaps4 


00997 


05ab 


4c 82 


06 




jmp fraterr 


00998 


05ae 










00999 


05ae 










01000 


05ae 


— => Calculate gap size <==• 


01001 


05ae 










01002 


05ae 


a8 




gaps4 


tay 


01003 


05a f 


8a 






txa 


01004 


05bO 


a2 00 






Idx #$00 


01005 


05b2 


38 




gaps5 


sec 


01006 


05b3 


e5 15 






sbc sectr 


01007 


05b5 


bO 03 






bcs gaps6 


01008 


05b7 


88 






dey 


01009 


05b8 


30 03 






bmi gaps? 


01010 


05ba 


e8 




gaps6 


inx 


01011 


05bb 


do f5 






bne gaps5 


01012 


05bd 


86 Oa 




gaps7 


stx nxtrk 


01013 


05bf 


ec 9e 1 


04 




cpx gap2 


01014 


05c2 


bO 03 






bcs gaps8 


01015 


05c4 


4c 82 06 




Jmp fmterr 


01016 


05c7 










01017 


05c7 










01018 


05c7 


===> Calculate control value. 


01019 


05c7 










01020 


05c7 


18 




gaps8 


clc 


01021 


05c8 


65 15 






adc sectr 



.A Is now 26 



.Y is number of sector plus 

remainder from .A 

leaving in (.Y,.A) the total of 

bytes 

including the header, plus one extra 

byte in each 

this is then subtracted from the 
track capacity in (countl), 
resulting In a 
total of the gap bytes 



Calculate gap size 
Format error 



total of gap bytes divided by the 
number of sectors 



highest sector number in current 
track 



number of bytes between sectors 
Calculate control value, write 8192 
zero ' s 
Format error 



write 8192 zero's <= 



highest sector number In current 
track 



DC Format Routine 



page 



.24 



line 


addr 


object 


source 


code 


01022 


05ca 


8d 


9e 07 




sta chksun 


01023 


05cd 


20 80 07 




jsr wrtnul 


01024 


05dO 










01025 


05dO 










01026 


05dO 




!> Record current sector header 


01027 


05dO 










01028 


05dO 


a9 de 


wrtsec 


Ida «$de 


01029 


05d2 


a2 


ff 




Idx f$ff 


01030 


05d4 


20 


2e 07 




jsr write 


01031 


05d7 


85 


4c 




sta via+pcr 


01032 


05d9 


20 2e 07 




jsr write 


01033 


05dc 


20 


2e 07 




jsr write 


01034 


05df 


a9 


dc 




Ida f$dc 


01035 


05e1 


20 


2e 07 




jar write 


01036 


05e4 


a2 


08 




Idx Ihbid 


01037 


05e6 


20 


2e 07 




jsr write 


01038 


05e9 


85 


4c 




sta via+pcr 


01039 


05eb 


a2 


ff 




Idx #$ff 


01040 


05ed 


ad 


9d 07 




Ida bkprty 


01041 


05fO 


24 


Ad 


wrtsel 


bit via+ifr 


01042 


05f2 


10 


fc 




bpl wrtsel 


01043 


05f4 


85 


80 




sta rriot+orega 


01044 


05f6 


24 


41 




bit via+pra 


01045 


05f8 


4d 


9c 07 




eor sector 


01046 


05fb 


ac 


9c 07 




Idy sector 


01047 


05fe 


ee 


9c 07 




inc sector 


01048 


0601 


24 


Ad 


wrtse2 


bit via+ifr 


01049 


0603 


10 


fc 




bpl wrtse2 


01050 


0605 


84 


80 




sty rriot+orega 


01051 


0607 


24 41 




bit via+pra 


01052 


0609 


4d 


9c 07 




eor sector 


01053 


060c 


8d 


9d 07 




sta bkprty 


01054 


060f 


aO 


02 




Idy #$02 


01055 


0611 


bl 


18 


wrtse3 


Ida (hdrpt),y 


01056 


0613 


24 


4d 


wrtse4 


bit via+ifr 


01057 


0615 


10 


fc 




bpl wrt3e4 


01058 


0617 


85 


80 




sta rriot+orega 


01059 


0619 


24 


41 




bit via+pra 


01060 


061b 


88 






dey 


01061 


061c 


10 


f3 




bpl wrtse3 


01062 


061 e 


a9 00 




Ida #$00 


01063 


0620 


ac 


9d 04 




Idy gapl 


01064 


0623 


24 


4d 


wrtse5 


bit via+ifr 


01065 


0625 


10 


fc 




bpl wrtse5 


01066 


0627 


85 80 




sta rriot+orega 


01067 


0629 


24 41 




bit via+pra 


01068 


062b 


88 






dey 


01069 


062c 


dO 


f5 




bne wrt3e5 


01070 


062e 


a9 


de 




Ida #$de 


01071 


0630 


20 2e 07 




jsr write 


01072 


0633 


85 


4c 




sta via+pcr 


01073 


0635 


20 


2e 07 




jsr write 



control for header checksum 

Record 32*256 null bytes to current 

track 



sync 

Send value in .X to output register 

peripheral control register 

Send value in .X to output register 

Send value in .X to output register 

Send value in .X to output register 

constant for block header 

Send value in .X to output register 

peripheral control register 

sync 

header checksum 

wait for bit 7 to set 

port a output register 
port a data register 
calculate checksum 
number of current sector 

wait for bit 7 to set 

port a output register 

port a data register 

next checksum 

header checksum 

offset in header buffer 

track, 1D2, IDl 

wait for bit 7 to set 

port a output register 
port a data register 



null code 

size of gap after sector header 

wait for bit 7 to set 

port a output register 
port a data register 

write .Y times 

Send value in .X to output register 

peripheral control register 

Send value in .X to output register 



DC Format Routine 



page 



.25 



line 


addr 


object 


source code 


01074 


0638 


20 2e 07 




jsr write 


01075 


063b 


a9 dc 




Ida #$dc 


01076 


063d 


20 2e 07 




jsr write 


01077 


0640 


a2 07 




Idi Ibid 


01078 


0642 


20 2e 07 




jsr write 


01079 


0645 


85 4c 




sta vla+pcr 
Idy #$00 


01080 


0647 


aO 00 




01081 


0649 


a2 00 




Idx #$00 


01082 


064b 


24 4d 


wrtse6 bit via+lfr 


01083 


064d 


10 fc 




bpl wrtse6 


01084 


064f 


86 80 




stx rriot+orega 


01085 


0651 


24 41 




bit via-t-pra 


01086 


0653 


88 




dey 


01087 


0654 


dO £5 




bne wrtse6 


01088 


0656 


a4 Oa 




Idy nxtrk 


01089 


0658 


20 2e 07 




jsr write 


01090 


065b 


24 4d 


wrtse? 


' bit via+lfr 


01091 


065d 


10 fc 




bpl wrt3e7 


01092 


065f 


86 80 




stx rriot+orega 


01093 


0661 


24 41 




bit via+pra 


01094 


0663 


88 




dey 


01095 


0664 


10 f5 




bpl wrt3e7 


01096 


0666 


ad 9c 07 




Ida sector 


01097 


0669 


c5 15 




crap sectr 


01098 


066b 


fO 03 




beq verfbk 


01099 


066d 


4c do 05 




jmp wrtsec 


01100 


0670 








01101 


0670 








01102 


0670 


»=> Verify current sector <=== 


01103 


0670 








01104 


0670 


20 Od 07 


verfbk 


jsr readb 


01105 


0673 


a9 00 




Ida #$00 


01106 


0675 


8d 9c 07 




sta sector 


01107 


0678 








01108 


0678 








01109 


0678 


=»=> Check header 


ID <==i 


01110 


0678 








01111 


0678 


20 3e 07 


verfbl 


jsr loop 


01112 


067b 


20 37 07 




Jsr read 


01113 


067e 


c9 08 




crap #hbld 


01114 


0680 


fO Oe 




beq 1310 


01115 


0682 








01116 


0682 








01117 


0682 


-==> Format 


: error 


<■" 


01118 


0682 








01119 


0682 


a9 Oc 


fmterr Ida #badfmt 


01120 


0684 








01121 


0684 








01122 


0684 









Send value in .X to output register 

Send value in .X to output register 

data block ID 

Send value In .X to output register 

peripheral control register 

block byte counter 

null code 

wait for bit 7 to set 

port a output register 
port a data register 

write 256 times 

Send value in .X to output register 
wait for bit 7 to set 

port a output register 
port a data register 



nunber of current sector 

highest sector number In current 

track 

Verify current sector 

Record current sector header and 

data to disk 



Read four header bytes 
number of current sector 



Loop to time non-sync area 
Read a data byte 

Read and store header checksum 



DC Format Routine 



page ... 26 



line 


addr 


object 




source 


code 




01123 


0684 


==> Permit ten tries before aborting <-=•= 


01124 


0684 












01125 


0684 


58 




fmterl 


ell 




01126 


0685 


e6 If 






Inc errcnt 


error counter 


01127 


0687 


aO Oa 






Idy ilttrles 




01128 


0689 


c4 If 






cpy errcnt 


error counter 


01129 


068b 


fO 79 






beq errr 


Exit with format done flag, error 
number in ,A 


01130 


068d 


4c 3d 


05 




Jmp fmttOl 


Check write protect status 


01131 


0690 












01132 


0690 












01133 


0690 


-=> Read 


and store header checksum <»»» 


01134 


0690 












01135 


0690 


20 37 


07 


1310 


Jsr read 


Read a data byte 


01136 


0693 


8d 9d 


07 




sta bkprty 


header checksum 


01137 


0696 


20 37 


07 




Jsr read 


Read a data byte 


01138 


0699 


cd 9c 


07 




cmp sector 


number of current sector 


01139 


069c 


dO e4 






bne fmterr 


Format error 


01140 


069e 


4d 9d 


07 




eor bkprty 


header checksum 


01141 


06a1 


aO 02 






Idy #$02 




01142 


06a3 


24 4d 




1330 


bit vla+lfr 


wait for bit 7 to set 


01143 


06a5 


10 fc 






bpl 1330 




01144 


06a7 


45 41 






eor vla+pra 


port a data register 


01145 


06a9 


88 






dey 




01146 


06aa 


10 f7 






bpl 1330 




01147 


06ac 


a8 






tay 




01148 


06ad 


dO d3 






bne fmterr 


Format error 


01149 


06af 


ee 9c 


07 




Inc sector 


number of current sector 


01150 


06b2 


20 3e 


07 




jsr loop 


Loop to time non-sync area 


01151 


06b5 


20 37 


07 




jsr read 


Read a data byte 


01152 


06b8 


c9 07 






cmp #bid 




01153 


06ba 


dO c6 






bne fmterr 


Format error 


01154 


06bc 


aO 00 






Idy #$00 




01155 


06be 












01156 


06be 












01157 


06be 


»=»> Calculate checksum for data 


sector <== 


01158 


06be 












01159 


06be 


24 4d 




verfb2 


bit vla+lfr 


wait for bit 7 to set 


01160 


06c0 


10 fc 






bpl verfb2 


Calculate checksum for data sector 


01161 


06c2 


a5 41 






Ida vla+pra 


port a data register 


01162 


06c4 


do be 






bne fmterr 


Format error 


01163 


06c6 


88 






dey 




01164 


06c7 


dO f5 






bne verfb2 


Calculate checksum for data sector 


01165 


06c9 


20 37 


07 




jsr read 


Read a data byte 


01166 


06cc 


do b4 






bne fmterr 


Format error 


01167 


06ce 


ad 9c 


07 




Ida sector 


number of current sector 


01168 


06d1 


c5 15 






cmp sectr 


highest sector number in current 
track 


01169 


06d3 


dO a3 






bne verfbl 


Check header ID 


01170 


06d5 


20 3e 


07 




jsr loop 


Ijoop to time non-sync area 


01171 


06d8 


ad 9f 


07 




Ida counth 


timer hi 


01172 


06db 


fO 03 






beq verfb3 




01173 


06dd 


4c 82 


06 




Jrap fmterr 


Format error 



DC Format Routine 



page .,.27 



11 



ne addr object 



01174 
01175 
01176 
01177 
01178 
01179 
01180 
01181 
01182 
01183 
01184 
01185 
01186 

01187 

01188 

01189 

01190 

01191 

01192 

01193 

01194 

01195 

01196 

01197 

01198 

01199 

01200 

01201 

01202 

01203 

01204 

01205 

01206 

01207 

01208 

01209 

01210 

01211 

01212 

01213 

01214 

01215 

01216 

01217 

01218 

01219 

01220 

01221 

01222 

01223 

01224 



06e0 

06eO 

06e0 

06e3 

06e4 

06e6 

06e7 

06ea 

06ec 

06ee 

06ef 

06f1 

06f3 

06f5 
06f8 
06f8 
06f8 
06f8 
06f8 
06fa 
06fb 
06fd 
06ff 
0701 
0704 
0704 
0704 
0704 
0704 
0706 
0706 
0706 
0706 
0706 
0708 
070a 

070d 
070d 
070d 
070d 
070d 
0710 
0712 
0714 
0716 
0718 
071a 
071c 
071e 
0721 
0723 



ad 9e 07 

38 

65 Oa 

38 

ed aO 07 

10 05 

49 f£ 

38 

69 00 

c9 Ic 

90 03 

4c 82 06 



source code 



verfb3 Ida chkaura 

sec 

adc nxtrk 

sec 

sbc countl 

bpl »erfb4 

eor l$ff 

sec 

adc #$00 
verfb4 cmp #$1c 

bcc finis 



jnip fmterr 



control for header checksum 

size of gap 

minus the total of bytes read 



between -28 and +28? 

Find out if this is last track to be 

formatted 

Format error 



:> Find out if this is last track to be formatted <== 

track currently being formatted 



e6 la finis inc ftnum 

58 cli 

a9 24 Ida Imaxtrk 

c5 la cmp ftnum 

fO 03 beq fmtend 

4c 2b 05 finlsl Jmp forraOl 

=■=> Exit with OK flag <==. 

a9 01 fmtend Ida #goodJ 



track currently being formatted 
Exit with OK flag 



=> Exit with format done flag, error number in .A <= 



aO ff 
84 la 
6c 02 fc 



Idy #$ff 
sty ftnum 
Jmp (donel) 



'=> Read four header bytes <= 



20 2e 07 readb jsr write 

24 4d readbl bit »ia+ifr 

'0 fc bpl readbl 

a9 fc Ida #readj 

85 4c sta via+pcr 

a9 92 Ida #$92 

85 4e sta vla+ier 

a2 03 Idx #$03 

20 37 07 readb2 Jsr read 

24 40 bit vla+prb 

ca dex 



track currently being formatted 
vector to disk controller Job 
completed 



Send value in .X to output register 
wait for bit 7 to set 



peripheral control register 

Interrupt enable register 

Read a data byte 
port b data register 



DC Format Routine page ...28 

line addr object source code 

01225 0724 dO f8 bne readb2 

01226 0726 60 rts 

01227 0727 

01 228 0727 

01229 0727 ===> Switch to write mode <== 

01230 0727 

01231 0727 aO 10 pwrlte Idy #wrltej 

01232 0729 84 4e sty via+ier interrupt enable register 

01233 072b 85 4c sta via+pcr peripheral control register 

01234 072d 60 rts 

01235 072e 

01 236 072e 

01237 072e ===> Send value in .X to output register <-= 

01 238 072e 

01239 072e 24 4d write bit via+ifr wait for bit 7 to set 

01240 0730 10 fc bpl write Send value in .X to output register 

01241 0732 86 80 stx rriot+orega port a output register 

01242 0734 24 41 bit via+pra port a data register 

01243 0736 60 rts 

01 244 0737 

01 245 0737 

01246 0737 ==> Read a data byte <== 

01247 0737 

01248 0737 24 4d read bit via+ifr wait for bit 7 to set 

01249 0739 10 fc bpl read Read a data byte 

01250 073b a5 41 Ida via+pra port a data register 

01251 073d 60 rts 

01252 073e 

01 253 073e 

01254 073e ==> Loop to time non-sync area <==■• 

01255 073e 

01256 073e aO 00 loop Idy #$00 timer lo 

01257 0740 8c 9f 07 sty counth timer hi 

01258 0743 24 82 loopl bit rriot+oregb look for a sync 

01259 0745 50 16 bvc loop3 found a sync 

01260 0747 24 4d bit via+ifr timed out? 

01261 0749 10 f8 bpl loopl keep looking 

01262 074b 24 41 bit via+pra port a data register 

01263 074d 24 40 bit via+prb port b data register 

01264 074f c8 iny timer lo 

01265 0750 dO fl bne loopl do this 65535 times 

01266 0752 ee 9f 07 inc counth timer/counter hi 

01267 0755 dO 03 bne loop2 keep looking 

01268 0757 4c 82 06 Jmp fmterr no sync found: format error 

01 269 075a 

01270 075a 4c 43 07 loop2 Jmp loopl keep looking 

01271 075d 

01272 075d 8c aO 07 loop3 sty countl sync found, so store non-sync times 

01273 0760 24 40 bit via+prb port b data register 

01274 0762 24 41 bit via+pra port a data register 

01275 0764 60 rts 

01 276 0765 

01277 0765 



DC Format Routine 



line addr object source code 



page ...29 



01278 0765 

01279 0765 

01280 0765 

01281 0767 

01 282 0769 

01283 076b 

01 284 076d 

01285 0770 

01286 0771 

01287 0773 

01288 0773 

01 289 0773 

01290 0773 

01291 0773 

01292 0775 

01 293 0776 

01 294 0778 

01295 077b 

01296 077d 



01297 

01298 

01299 

01300 

01301 

01302 

01303 

01304 

01305 

01306 

01307 

01308 

01309 

01310 

01311 

01312 

01313 

01314 

01315 

01316 

01317 

01318 

01319 

01320 

01321 

01322 

01323 

01324 

01325 

01326 



077f 

0780 

0780 

0780 

0780 

0780 

0782 

0784 

0786 

0789 

078b 

078e 

0791 

0792 

0794 

0797 

0799 

079a 

079a 

079a 

079a 

079a 

079c 

079c 

079c 

079c 

079c 

079d 

079d 

079d 



=■> Create header image for first sector <- 



aO 02 
a5 la 
91 18 

a9 00 
8d 9c 07 
c8 
91 18 



wrtshd Idy #$02 
Ida ftnum 
sta (hdrpt),y 

Ida #$00 

sta sector 

iny 

sta (hdrpt),y 



=>> Calculate checksum <»-3 



51 18 wrtshi eor (hdrpt),y 

88 dey 

'0 fb bpl wrtshi 

8d 9d 07 sta bkprty 

aO 04 idy #$04 

91 18 sta (hdrpt),y 

60 rts 



offset in header buffer 

track currently being formatted 

pointer to active values In header 

table 

number of current sector 

offset to sector 

pointer to active values in header 

table 



pointer to active values in header 
table 

Calculate checksum 

header checksum 

offset parity 

pointer to active values in header 

table 



»> Record 32*256 null bytes to current track <» 



a2 00 
aO 00 
a9 20 
8d 9f 07 
a9 dc 
20 27 07 
20 2e 07 
88 

dO fa 
ce 9f 07 
dO f5 
60 



wrtnul Idx #$00 
Idy #$00 
Ida #32 
sta counth 
Ida #$dc 
Jsr pwrite 

wrtnul Jsr write 
dey 

bne wrtnul 
dec counth 
bne wrtnul 
rts 



null byte 
counter lo 

timer/counter hi 

Switch to write 

Send value in .X to output register 

timer/counter hi 



"==■> step bits drive 0/1 <-=» 
Oc 03 stepbt .byte $0c, $03 

=> number of current sector <=■ 
48 sector .byte $48 



DC Format Routine page ...30 

line addr object source code 

01327 079d =•=»> header checksum <— 

01328 079d 

01329 079d 53 bkprty .byte $53 

01330 079e 

01331 079e 

01332 079e => control for header checksum <= 

01333 079e 

01334 079e 50 chksum .byte $50 

01335 079f 

01336 079f 

01337 079f ==> timer/counter hi <== 

01338 079f 

01339 079f aa counth .byte $aa 

01 340 07aO 

01341 07aO 

01342 07a0 >•=■> timer/counter lo <=•= 

01343 07a0 

01344 07aO 02 countl .byte $02 

01345 07a 1 

01345 07a1 .end 

01346 07al .end 

errors In pass 1 = 00000 

errors in pass 2 = 00000 

assembly completed 



crossreference 



page ...31 



label address line numbers 



acr 


- $0b: 


74, 


166 














actjob 


- $04aO: 


106, 


409 














andb 


- $ffe8: 


845, 


848, 


864 












andc 


=. $ffea: 


201, 


204, 


810, 


815. 


865 








andd 


- $ffec: 


343, 


842, 


849, 


866 










badbch 


= $05: 


12, 


561 














bad f rat 


= $0c: 


17, 


1119 














badhch 


= $09: 


15, 


633 














badld 


- $0b: 


16, 


639 














bid 


= $07: 


19, 


469, 


521, 


1077, 


1152 








bkprty 


= $079d: 


1040, 


1053, 


1136, 


1140, 


1294, 


1329 






brapfl 


= $c1: 


26. 


340, 


894 












bufpnt 


= $21: 


23, 


428, 


914 












bufpt 


= $16: 


58, 


169, 


333, 


334, 


401, 


455. 


530, 


552 


bump 


= $fd2a: 


248, 


339 














burapj 


= $40: 


32. 


232, 


246, 


286 










byte 


= $f f 51 : 


558, 


756, 


757, 


778. 


780, 


782 






chkspd 


= $054a: 


940, 


946 














chksura 


= $079e: 


1022, 


1176, 


1334 












counth 


= $079 E: 


988, 


995, 


1171, 


1257, 


1266, 


1305, 


1311, 


1339 


countl 


- $07aO: 


986, 


1180, 


1272, 


1344 










cow 


= $07: 


47, 


840, 


850 












csect 


= $0c: 


52. 


354. 


393. 


397 










csectr 


= $0b: 


51, 


391, 


396 












cserr 


= $fecb: 


594, 


633 














ctrack 


= $09: 


49. 


269, 


277 












cutrat 


- $0402: 


97. 


156, 


695 












ddrb 


- $02: 


71. 


155 














delay 


=> $0401 : 


96, 


177, 


207 












done 


- $fec6: 


348, 


565, 


627 












donei 


- $fc02: 


113, 


129, 


1209 












drega 


= $01: 


84, 


157 














dregb 


- $03: 


86, 


160 














drive 


- $12: 


54, 


198, 


243. 


319, 


321, 


379, 


596, 


693 


drvat 


= $03: 


45, 


174. 


175, 


213, 


217, 


253. 


287, 


290, 






341, 


597. 


811. 


822. 


829, 


831, 


852, 


895 


dstrt 


- $fddd: 


447, 


465. 


548 












dstrtx 


- $fdef: 


470, 


477 














err2 


= $fec8: 


573. 


628, 


634, 


640 










errcnt 


- $1f: 


62. 


917, 


931, 


1126, 


1128 








error 


= $ff08: 


129. 


491. 


628, 


690, 


747 








errr 


= $0706: 


1129, 


1207 














errx 


- $fdfa: 


472, 


491 














eseek 


= $febc: 


600, 


618 














exi 


= $fd20: 


191, 


324, 


330 












exec 


- $eO: 


37. 


323, 


382 












finis 


= $06f8: 


1186. 


1192 














finisi 


- $0701 : 


1197 
















fratend 


= $0704: 


1196. 


1202 














Eraterl 


= $0684: 


941, 


1125 














fraterr 


= $0682: 


963, 
1173, 


997. 
1187. 


1015, 
1268 


1119. 


1139, 


1148, 


1153, 


1162, 


fmttOI 


= $053d: 


936, 


1130 















300 



crossreference 



page ...32 



label 



address line numbers 



fmttrk 


_ 


$0533: 


892, 


927 
















formO 


_ 


$0517: 


907, 


908 
















formOl 


K 


$052b: 


920, 


929, 


1197 














formt 


_ 


$0500: 


111, 


891 
















fsnum 


=. 


$fdbb: 


«7, 


543, 


700 














fsnuffll 


S 


$fd3f: 


353, 


440, 


611 














fsnum2 


a 


$fd4e: 


359, 


365 
















fsnuiii3 


a 


$fd56: 


371, 


403 
















fsnunsA 


= 


$fd7b: 


388, 


391 
















fsnumS 


a 


$fd8e: 


372, 


376, 


380, 


383, 


394, 


402 








fsnuiii6 


a 


$fd98: 


405, 


409 
















ftnum 


= 


$la: 


60, 


158, 


891, 


919, 


1192, 


1195, 


1208, 


1281 




gapl 


:. 


$0A9d: 


102, 


499, 


970, 


1063 












gap2 


= 


$049e: 


103, 


1013 
















gaps 


i> 


$0578: 


962, 


968 
















gapsi 


= 


$0586: 


975, 


981 
















gaps2 


1 


$058c: 


977, 


979 
















gaps3 


= 


$059e: 


987, 


989 
















gapsA 


= 


$05ae: 


996, 


1002 
















gaps5 


t: 


$05b2: 


1005, 


1011 
















gaps6 


= 


$05ba: 


1007, 


1010 
















gaps? 


3> 


$05bd: 


1009, 


1012 
















gapsS 


c 


$05c7: 


1014, 


1020 
















good J 


> 


$01: 


8, 


627, 


1202 














gotu 


m 


$fcf4: 


256, 


259, 


300 














gotui 


= 


$fcfc: 


308, 


310 
















hbid 


= 


$08: 


20, 


713, 


1036, 


1113 












hdrpt 


= 


$18: 


59, 


179, 


258, 


303, 


374, 


386, 


429, 


438, 


606 








620, 


651, 


655, 


667, 


915, 


928, 


1055, 


1282, 


1286 








1291, 


12% 
















head 


= 


$ff02: 


581, 


662, 


682, 


714 












iderr 


= 


$£ecf: 


608, 


639 
















ler 


= 


$0e: 


77, 


164, 


497, 


777, 


1220, 


1232 








ifr 


= 


$0d: 


76, 


452, 


505, 


517, 


527, 


549, 


564, 


585, 


664 








720, 


756, 


773, 


787, 


1041, 


1048, 


1056, 


1064, 


1082 








1090, 


1142, 


1159, 


1215, 


1239, 


1248, 


1260 






Irq 


a 


$ff82: 


796, 


872 
















irqOI 


= 


$ff8e: 


807, 


857 
















irq04 


= 


$ffa5: 


813, 


818 
















irq05 


= 


$ffaa: 


809, 


827 
















irq07 


1 


$ffb7: 


828, 


837 
















lrq08 


3 


$ffcd: 


843, 


847 
















irqlO 


» 


$ffd2: 


846, 


849 
















lrql2 


= 


$£fel: 


832, 


853, 


856 














irq40 


= 


$ffa8: 


818, 


822 
















irqcnt 


s 


$00: 


43, 


148, 


149, 


206, 


215, 


694, 


801, 


807, 


854 


job 


•1 


$le: 


61, 


245, 


322, 


412. 


423, 


598 








jobnum 


= 


$lf: 


63, 
419, 


190, 
539, 


235, 
656, 


274. 
690, 


330, 
921 


367, 


395, 


402, 


410 


Jobs 


= 


$0403: 


98, 


151, 


186, 


420, 


540, 


542, 


691 






Jurapc 


» 


$dO: 


36, 


188 
















JurapJ 


= 


$50: 


33 


















1100 


= 


$fdcb: 


452, 


453. 


459 















crossreference 



page 



.33 



label address line numbers 



1200 


- $fe08 


: 505, 


506, 


509 














1202 


- $fe22 


: 517, 


518 
















1203 


- $fe32 


: 527, 


528, 


535 














1204 


- $f£58 


: 538, 


764 
















1210 


- $fe5a 


: 549, 


550, 


557 














1211 


- $fe6b 


: 460, 


558 
















12111 


- $fe76 


: 560, 


563 
















1212 


- $fe7e 


: 553, 


572 
















1213 


- $fe80 


: 562, 


566, 


573 














1250 


- $£e8d 


: 585, 


586, 


592 














1251 


- $febe 


: 619, 


622 
















1252 


- $feaf 


: 606, 


610 
















1310 


- $0690 


: 1114, 


1135 
















1330 


- $06a3 


: 1142, 


1143, 


1146 














1410 


- $fee4 


: 662, 


668 
















1411 


- $fee9 


: 664, 


665, 


670 














1412 


- $fed7 


: 651, 


653 
















1420 


- $ff24 


: 684, 


712 
















1421 


- $ffle 


699, 


705 
















1423 


- $ff2c 


718, 


721, 


725 














1424 


- $ff3d 


719, 


727 
















1430 


- $ff45 


746, 


749 
















1442 


- $ff62 


773, 


774 
















loop 


- $073e 


959, 


1111, 


1150, 


1170, 


1256 










loopl 


- $0743 


1258, 


1261, 


1265, 


1270 












loop2 


- $075a 


1267, 


1270 
















loop3 


- $075d 


1259, 


1272 
















inaxtrk 


- $24 


24. 


1194 
















intrtm 


- $0t 


44, 


208, 


216, 


696, 


808, 


855 








nexts 


- $14 


56, 


365, 


387 














nodblk 


> $04 


11, 


471 
















nohdr 


- $02- 


9. 


685 
















nosync 


- $03: 


10, 


741 
















nunisec 


- $0499: 


101, 


311 
















nxtrk 


- $0a: 


50, 


260, 


268, 


971, 


976, 


1012, 


1088, 


1178 




offbyt 


- $0f: 


22, 


955, 


961 














orega 


- $00: 


83, 
1092, 


522, 
1241 


531, 


789, 


1043, 


1050, 


1058, 


1066, 


1084 


oregb 


- $02: 


85, 


316, 


320, 


484, 


718, 


726, 


748, 


939, 


1258 


out 


- $ff79: 


514, 


515, 


516, 


537, 


764, 


766, 


787, 


788 




per 


- $0c: 


75. 
1072, 


162, 
1079, 


511, 
1218, 


520, 
1233 


775, 


950, 


957, 


1031, 


1038 


pra 


- $01: 


70, 


454, 


507, 


519, 


529, 


551, 


587, 


666, 


722 






751, 


758, 


790, 


1044, 


1051, 


1059, 


1067, 


1085, 


1093 






1144, 


1161, 


1242, 


1250, 


1262, 


1274 








prb 


= $00: 


69, 


154, 


200, 


203, 


205, 


344, 


345, 


672, 


674 






676. 


723, 


750, 


779, 


781, 


812, 


816, 


817, 


838 






841, 


851, 


898, 


899, 


1223, 


1263, 


1273 






pwrite 


= $0727: 


1231, 


1307 
















que 


- $fc92: 


219, 


231 
















quel 


- $fc9b: 


240, 


275 
















que2 


=. $fccf: 


241, 


244, 


266, 


274 












que4 


= $fcaf: 


247, 


253 

















crossreference 



page ... 35 



label 



address line nurobers 









205, 


344, 


345, 


452, 


454, 


497, 


505, 


507, 


511 








517, 


519, 


520, 


527, 


529, 


549, 


551, 


564. 


585 








587, 


664, 


666, 


672, 


674, 


676, 


720, 


722, 


723 








740, 


746, 


750, 


751, 


756, 


758, 


773, 


775, 


777 








779, 


781, 


787, 


790, 


812, 


816, 


817, 


838, 


841 








851, 


898, 


899, 


950, 


957, 


1031, 


1038, 


1041, 


1044 








1048, 


1051, 


1056, 


1059, 


1064, 


1067, 


1072, 


1079, 


1082 








1085, 


1090, 


1093, 


1142, 


1144, 


1159, 


1161, 


1215, 


1218 








1220, 


1223, 


1232, 


1233, 


1239, 


1242, 


1248, 


1250, 


1260 








1262, 


1263, 


1273, 


1274 












work 


_ 


$08: 


48, 


233. 


265, 


267, 


276, 


282, 


289, 


315, 


318 








373, 


377, 


456, 


457, 


466, 


524, 


532, 


533, 


554 








555, 


559, 


579, 


589, 


590 










wprot 


T. 


$fdfO: 


446, 


482 
















vnrlte 


= 


$07 2e: 


949, 


951, 


952, 


954, 


956, 


1030, 


1032, 


1033, 


1035 








1037, 


1071, 


1073, 


1074, 


1076, 


1078, 


1089, 


1214, 


1239 








1240, 


1308 
















writej 


m 


$10: 


29, 


496, 


1231 














wrprot 


m 


$08: 


14, 


938 
















wrtnul 


3 


$078e: 


1308, 


1310, 


1312 














wrtnul 


s 


$0780: 


946, 


1023, 


1302 














wrtsel 


= 


$05fO: 


1041, 


1042 
















wrt8e2 


a 


$0601: 


'1048, 


1049 
















wrtseS 


= 


$061 1 : 


1055, 


1061 
















wrtse4 


» 


$0613: 


1056, 


1057 
















wrtseS 


9i 


$0623: 


1064, 


1065, 


1069 














wrt8e6 


= 


$064b: 


1082, 


1083, 


1087 














wrt3e7 


= 


$065b: 


1090, 


1091, 


1095 














wrtsec 


= 


$05dO: 


1028, 


1099 
















wrtshl 


= 


$0773: 


1291, 


1293 
















wrtshd 


= 


$0765: 


920, 


937, 


1280 














wverer 


= 


$07: 


13, 


572 

















croasreference 



label address line numbers 



page ,..34 



que5 

que6 

que? 

read 

readb 

readbl 

readb2 

readc 

readj 

reed 

resel 

rese2 

rese22 

reset 

rite 

rriot 



- $fcc5 

- $fcde 

- $fced 
= $0737 
= $070d 
= $0710 

- $071e 

- $80 

- $fc 

- $fdc4 
» $fc09 

- $fc16 
» $fc12 

- $fc04 

- $fdfd 

- $80 



sector = $079c: 



sectr 

seek 

seekj 

setjob 

srch 

stab 

start 

startl 

start2 

starts 

startA 

starts 

start6 

startl 

stepbt 

steps 

St pent 

synci 

tich 

tllcl 

tab! 

tick 

timer 

track 

tries 

verfbl 

verfb2 

verfb3 

verfbA 

verfbk 

verfy 

verfyj 



- $15: 

- $fe82: 

- $30: 
=■ $fda5: 

- $fed3: 

$0d: 

- $fc54: 

- $fc56: 

- $fc65: 

- $fc80: 
= $fc8a: 
= $fc8d: 
= $fc90: 

- $fc00: 
= $079a: 
=• $05: 

- $8c: 
= $ff3e: 
= $05: 

- $04: 

- $fceE: 

- $0400: 
=■ $0f: 
= $13: 

$0a: 

- $0678: 
=■ $06be: 
= $06e0: 
= $06fl: 
= $0670: 
= $fe57: 

$20: 
= $40: 



261, 
278, 
291, 
960, 
958, 
1215, 
1222, 
35, 
28, 
413, 
143, 
150, 
148, 
114, 
486, 
82, 
718, 
1066, 
1045, 
1284, 
57. 
325, 
31, 
240, 
467, 
53, 
124. 
185, 
189, 
202, 
214, 
187, 
226, 
112, 
897. 
46. 
25. 
468. 
73, 
72, 
294. 
95, 
87, 
55, 
21, 

nil, 

1159, 
1172, 
1181, 
1098, 
483. 

30, 

68. 



265 
282 
301 
1112. 
1104. 
1216 
1225 
173 
161, 
445 
871 
150 
153 
134, 
496 
157, 
726, 
1084, 
1046. 
1323 
312. 
578 
599 
371. 
498. 
355. 
184. 
225 
196 
213 
218 
224 
291 
124, 
1318 
285, 
346, 
712, 
740, 
168 
308, 
134, 
172, 
255. 
1127 
1169 
1160. 
1176 
1185 
1104 
548 
482 
154. 



1135, 1137. 1151, 1165, 1222, 1248. 1249 
1214 



767. 1217 



135 



160, 172. 316. 320. 484, 522. 531 

748, 789, 800, 939, 1043, 1050, 1058 

1092, 1241, 1258 

1047. 1052. 1096. 1106, 1138. 1149. 1167 

358, 390. 972. 1006. 1021. 1097. 1168 



411. 419 

645 

439. 588, 

226, 406, 



595, 

707 



607, 619 



922 

347, 827. 844. 847. 901. 907 

900 * 

738 

746 

839 
146. 171. 799 
800 
375 



1164 



155. 162. 164. 166, 168. 200, 203